报错Traceback (most recent call last): File... .format(val=len(data), ind=len(index))) ValueError: Length of passed values is 400, index implies 1

我是个小菜鸟,在尝试写生成高斯分布的作业时被报错:

D:\Anaconda\python.exe "F:/All tasks in BFU/Study abroad/Internship2019.8 in Google/Homework/Course1/Exercise6/exercise6.py"
Traceback (most recent call last):
  File "F:/All tasks in BFU/Study abroad/Internship2019.8 in Google/Homework/Course1/Exercise6/exercise6.py", line 20, in <module>
    y = func(x, mean, std)
  File "F:/All tasks in BFU/Study abroad/Internship2019.8 in Google/Homework/Course1/Exercise6/exercise6.py", line 15, in func
    f = math.exp(-((x - mu) ^ 2)/(2*sigma ^ 2))/(sigma * math.sqrt(2 * math.pi))
  File "D:\Anaconda\lib\site-packages\pandas\core\ops.py", line 1071, in wrapper
    index=left.index, name=res_name, dtype=None)
  File "D:\Anaconda\lib\site-packages\pandas\core\ops.py", line 980, in _construct_result
    out = left._constructor(result, index=index, dtype=dtype)
  File "D:\Anaconda\lib\site-packages\pandas\core\series.py", line 262, in __init__
    .format(val=len(data), ind=len(index)))
ValueError: Length of passed values is 400, index implies 1

Process finished with exit code 1
  我有安装anaconda,但是报错中貌似表明panda这个package的问题。请问大神大佬,我存在什么问题呀应该怎么解决⊙︿⊙,我好像没在网上找到和我一样的问题,不敢和网上的回答一样在命令提示符里输入命令怕搞错(。•́︿•̀。),是我比较菜鸟又急着所以麻烦了!!
 附上我的作业代码:
import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# import matplotlib.mlab as mlb
data = pd.read_csv('example-exercise6.csv')  # read file of data
# data = data_['time']

mean = data.mean()     # average of data
std = data.std()   # std

def func(x, mu, sigma):
    f = math.exp(-((x - mu) ^ 2)/(2*sigma ^ 2))/(sigma * math.sqrt(2 * math.pi))
    return f

x = np.arange(60, 100, 0.1)
y = func(x, mean, std)
plt.plot(x, y)
plt.hist(data, bins=10, rwidth=0.9, normed=True)

# x = np.arange(145, 155,0.2)
# y = normfun(x, mean, std)
# plt.plot(x,y,'g',linewidth = 3)
# plt.hist(data, bins = 6, color = 'b', alpha=0.5, rwidth = 0.9, normed=True)
# plt.title('stakes distribution')
# plt.xlabel('stakes time')
# plt.ylabel('Probability')

plt.show()

( 其中csv文件是:)

87
88
83
83
86
80
84
90
84
80
94
89
76

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Traceback (most recent call last): File "structure.py"...
安装fastStructure软件,运行python structure.py,出现错误: ``` $ python structure.py Traceback (most recent call last): File "structure.py", line 3, in <module> import fastStructure File "vars/admixprop.pxd", line 5, in init fastStructure cdef class AdmixProp: File "allelefreq.pxd", line 7, in init admixprop ImportError: No module named allelefreq ``` 请问这个问题怎么解决?用的python2.7.15rc,fastStructure安装也都是按照软件说明步骤进行的。
pip3 install ERROR: Exception: Traceback (most recent call last)
操作系统:macOS。 凡是在使用"pip3 install XXX"时,都会出现如下报错。 和网上别人提出的报错内容不太一致,网上看到的方法都试过了也没有用。所以来请求大佬们帮助。 ``` ERROR: Exception: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 397, in _error_catcher yield File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 479, in read data = self._fp.read(amt) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read data = self.__fp.read(amt) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 457, in read n = self.readinto(b) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 501, in readinto n = self.fp.readinto(b) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1071, in recv_into return self.read(nbytes, buffer) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 929, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main status = self.run(options, args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 345, in run resolver.resolve(requirement_set) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve self._resolve_one(requirement_set, req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for self.require_hashes File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 199, in prepare_linked_requirement progress_bar=self.progress_bar File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 1064, in unpack_url progress_bar=progress_bar File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 924, in unpack_http_url progress_bar) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 1152, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 861, in _download_url hashes.check_against_chunks(downloaded_chunks) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/hashes.py", line 75, in check_against_chunks for chunk in chunks: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 829, in written_chunks for chunk in chunks: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 156, in iter for x in it: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/download.py", line 818, in resp_read decode_content=False): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 531, in stream data = self.read(amt=amt, decode_content=decode_content) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 496, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 402, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. ```
python报错:requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')"))
代码如下: ``` #!/usr/bin/env python # coding=utf-8 #import importlib,sys #import sys #sys.setdefaultencoding('gbk') from urllib.parse import quote '''import sys import imp import sys reload(sys) sys.setdefaultencoding('utf8') ''' ''' import urllib import urllib2 import requests import sys sys.setdefaultencoding('utf-8') import jieba import json''' #from bs4 import BeautifulSoup import urllib.request import urllib.parse as parse import ssl import re import os,os.path import codecs import requests def getText(html): '''headers = {'Host': 'https://pypi.org','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) ''' #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) #headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'} #import requests res = requests.get(html) res.encoding = 'utf-8' #print(res.text) words=res.text ''' soup = BeautifulSoup(res.text, "html.parser") words = "" for a1 in soup.find_all("a"): words = words + str(a1.string) ''' return words def file(url1,file_name,name): print(url1) headers = {'Host': 'https://files.pythonhosted.org/packages/','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) request = requests.get(url=url1,headers=headers) #response = urllib.request.urlopen(request) global i i += 1 print(request.content) file = open(name ,'wb+') file.write(request.content) file.close() print(file_name) print("Completed : .... %d ..." % x) '''for i in range(len(name_list)): j=0 if name_list[i-24:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i+1:i+60])''' def get(url): global name_list1 res=getText(url) #print('\n\n\n\n\n\nok\n\n\n\n\n\n\n\n\n\n') #name_list = getText(url) #print(res) print('html done,page:'+str(count)+'\n') for i in range(len(res)): #j=0 if (res[i-8:i+1]=='/project/')==True: name_list1.append('https://pypi.org'+res[i-8:i+20]) #print(name_list1) def trim(list1): k=0 list2=[] for i in list1: j=25 while j<len(list1[k]): if list1[k][j]=='/': list2.append(list1[k][0:j]) break j+=1 k+=1 return list2 def get1(url): """o=0 for n in len(url): if url[n]=='"': url=url[0:n-1]+'#files' """ global namelist url=url+'#files' #import requests res = requests.get(url) res.encoding = 'utf-8' #print(res.text) html=res.text for p in range(len(html)): stri='https://files' if html[p-len(stri):p]==stri: namelist.append(html[p-len(stri):p+170]) import httplib2 as httplib httplib.HTTPConnection._http_vsn = 10 httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0' ''' #-*- coding:utf-8 -*- import time import hmac import hashlib import requests import json import mysql.connector import requests import httplib2 as httplib import urllib from urllib import unquote import json def query_total_flow(): header = {"Content-Type": "application/json", 'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'} post_data = { "operator": "xxxxxx", # 调用系统的名字 "type": "set", "set_id": [1], "set_name": [], "feature_type": ["入流量"], "date": "2019-06-15", "begintime": "23:55", "endtime": "23:59", } url = "http://xxx.xxx.xxx.xxx:80/xxxxx/xxxxx/xxxxx.cgi/json?" post_data = json.dumps(post_data, ensure_ascii=False, separators=(',',':')) print (post_data) # url = url + post_data url = url + urllib.urlencode({'data': post_data}) # data = urllib.urlencode({'data': post_data}) # print post_data # print data data = unquote(url) try: # print data print (data) response = requests.get(url, json=data, timeout=60, headers=header) print (response.headers) print (response.url) print (response.text.encode('utf-8')) if response['code'] != 0: result_dict = json.loads(response.text) data = result_dict["data"] print(data) print(data) set_info = [] return response raise exp_with_err_instance(err.RESULT_ERROR, 'can not find inst info') print ("none!") return [] except Exception as e: print ("Exception") raise if __name__ == "__main__": query_total_flow() ''' save_path = os.getcwd() ''' url = 'https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3' name_list = getText(url) print(name_list) print('html done') #html.decode('utf-8') #print(name_list)''' x=1 files=os.listdir(save_path) #print(files) #print(type(name_list)) name_list1=[] #print(name_list) #for name in name_list: k=0 # name[k]=str(name1[k]) '''for i in range(len(name_list)): j=0 if name_list[i-25:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i-25:i+20]) for u in range(len(name_list1[len(name_list1)])): if name_list1[len(name_list1)][u]==' ': name_list1[len(name_list1)]=name_list1[len(name_list1)][0:u-1] ''' global count count=2 name_list1=[] for count in range(51): get('https://pypi.org/search/?c=Programming+Language+%3A%3A+Python+%3A%3A+3&page='+str(count)) """ global m if k<len(name_list1): for l in range(len(name_list1[k])): if l-9>=0: if name_list1[k][l-4:l]=='.whl' or name_list1[k][l-3:l]=='.gz' or name_list1[k][l-4:l]=='.zip': j=1 m=l if j==1: name_list1[k]=name_list1[k][0:m] k+=1""" '''if j==0: name_list.remove(name)''' #file_name = os.path.join(save_path ,name) #i=0 #print(name) #print(name_list1) namelist=[] h=0 for y in trim(name_list1): get1(y) #print(namelist) '''if h==3: break''' h+=1 i=0 for name in namelist: j=0 for l in range(len(name)): if l-9>=0: if name[l-4:l]=='.whl' or name[l-3:l]=='.gz' or name[l-4:l]=='.zip': j=1 m=l break if j==1: name=name[0:m] k+=1 while m>0: if m<len(name): if name[m]=='/': filename=name[m+1:len(name)]#p] break m-=1 if filename in files: continue '''if name=='Delny‑0.4.1‑cp27‑none‑win_amd64.whl</a></li>\n<li>' or name==Delny‑0.4.1‑cp27‑none‑win32.whl</a></li> </ul> </: continue ''' print('no:'+str(x)) print('\ndownload '+name) # importlib.reload(sys) #imp.reload(sys) for l in range(len(name)): if l-9>=0: if name[l-4:l]=='.whl' or name[l-3:l]=='.gz' or name[l-4:l]=='.zip': j=1 m=l break if j==1: name=name[0:m] k+=1 p=m #string='https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/' + name#[0:4+name.find('.whl')]#https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/ print('00'+save_path) #file(name,save_path,filename) url1=name +'/' + filename url1=url1.encode() name=filename file_name=save_path #file = open(name ,'wb+') #file.write(url1 ) #file.close() #print(file_name) headers = {'Host': 'https://files.pythonhosted.org/packages/','User-Agent':'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER','Referer': 'https://pypi.org/', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Language': 'zh-CN,zh;q=0.8'} #req = urllib.urlretrieve(download_url,headers=headers) #urllib.request.urlopen('https://www.lfd.uci.edu/~gohlke/pythonlibs/') #req = urllib.request.Request(url=url,headers=header) #request = urllib.request.urlopen(url1) #response = urllib.request.urlopen(request) urllib.request.urlretrieve(url1.decode(),name) i += 1 print(url1.decode()) #file = open(name ,'wt+') #file.write(str(req.content())) #file.close() print(file_name) print("Completed : .... %d ..." % x) '''for i in range(len(name_list)): j=0 if name_list[i-24:i+1]=='https://pypi.org/project/': name_list1.append(name_list[i+1:i+60])''' print('\n........'+filename+'..........complete\n') x=x+1 print('09') print('finished') ``` 报错: Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> ===================== RESTART: E:\2345Downloads\版本2下载whl.py ==================== Traceback (most recent call last): File "E:\2345Downloads\版本2下载whl.py", line 154, in <module> httplib.HTTPConnection._http_vsn = 10 AttributeError: module 'httplib2' has no attribute 'HTTPConnection' >>> 如果不加 ``` import httplib2 as httplib httplib.HTTPConnection._http_vsn = 10 httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0' ``` 就会 Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse response.begin() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin version, status, reason = self._read_status() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\contrib\pyopenssl.py", line 318, in recv_into raise SocketError(str(e)) OSError: (10060, 'WSAETIMEDOUT') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 719, in urlopen retries = retries.increment( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 400, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\packages\six.py", line 734, in reraise raise value.with_traceback(tb) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse response.begin() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin version, status, reason = self._read_status() File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\contrib\pyopenssl.py", line 318, in recv_into raise SocketError(str(e)) urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')")) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\2345Downloads\版本2下载whl.py", line 282, in <module> get1(y) File "E:\2345Downloads\版本2下载whl.py", line 141, in get1 res = requests.get(url) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 75, in get return request('get', url, params=params, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(10060, 'WSAETIMEDOUT')")) 求高手解决
部署flask项目到heroku上时,出现psycopg2.errors.UndefinedTable: relation "question" does not exist问题,该怎么解决?
当我把flask项目部署到heroku上后,打开app时显示**Internal Server Error**. 报错为 ``` psycopg2.errors.UndefinedTable: relation "question" does not exist ``` 我google下,可能是由于migrations文件导致的,于是我就把该文件删掉了。但依然出现同样的问题。 求大神帮忙,现在踩在坑里有点出不去了。 这是我的config.py文件: ``` import os DEBUG = True SECRET_KEY = os.urandom(24) MAX_CONTENT_LENGTH = 1 * 1024 * 1024 SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') SQLALCHEMY_TRACK_MODIFICATIONS=False ``` 下面是heroku 的logs: ``` 2019-11-17T08:43:29.637889+00:00 app[web.1]: [2019-11-17 08:43:29 +0000] [11] [ERROR] Error handling request / 2019-11-17T08:43:29.637935+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:43:29.637940+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:43:29.637942+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:43:29.637945+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:43:29.637947+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:43:29.637949+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T08:43:29.637952+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:43:29.637955+00:00 app[web.1]: ^ 2019-11-17T08:43:29.637956+00:00 app[web.1]: 2019-11-17T08:43:29.637958+00:00 app[web.1]: 2019-11-17T08:43:29.637960+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T08:43:29.637962+00:00 app[web.1]: 2019-11-17T08:43:29.637964+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:43:29.637966+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T08:43:29.637968+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T08:43:29.637970+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T08:43:29.637972+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T08:43:29.637984+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T08:43:29.637986+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T08:43:29.637988+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T08:43:29.637990+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T08:43:29.637992+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T08:43:29.637993+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:43:29.637995+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:43:29.637997+00:00 app[web.1]: raise value 2019-11-17T08:43:29.637999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T08:43:29.638000+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T08:43:29.638002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T08:43:29.638004+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T08:43:29.638006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T08:43:29.638008+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:43:29.638010+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:43:29.638011+00:00 app[web.1]: raise value 2019-11-17T08:43:29.638013+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T08:43:29.638015+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T08:43:29.638017+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T08:43:29.638019+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T08:43:29.638021+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T08:43:29.638023+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T08:43:29.638025+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T08:43:29.638027+00:00 app[web.1]: return list(self) 2019-11-17T08:43:29.638029+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T08:43:29.638031+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T08:43:29.638033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T08:43:29.638035+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T08:43:29.638037+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T08:43:29.638039+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T08:43:29.638041+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T08:43:29.638043+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T08:43:29.638045+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T08:43:29.638047+00:00 app[web.1]: distilled_params, 2019-11-17T08:43:29.638049+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T08:43:29.638051+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T08:43:29.638053+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T08:43:29.638055+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T08:43:29.638057+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T08:43:29.638059+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T08:43:29.638061+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T08:43:29.638063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T08:43:29.638076+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:43:29.638079+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:43:29.638081+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:43:29.638083+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:43:29.638085+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T08:43:29.638087+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:43:29.638089+00:00 app[web.1]: ^ 2019-11-17T08:43:29.638091+00:00 app[web.1]: 2019-11-17T08:43:29.638095+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T08:43:29.638097+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T08:43:29.638099+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T08:43:29.638285+00:00 app[web.1]: 10.61.164.89 - - [17/Nov/2019:08:43:29 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T08:44:42.918911+00:00 app[web.1]: [2019-11-17 08:44:42 +0000] [11] [ERROR] Error handling request / 2019-11-17T08:44:42.918940+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:44:42.918944+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:44:42.918946+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:44:42.918948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:44:42.918950+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:44:42.918952+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T08:44:42.918955+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:44:42.918957+00:00 app[web.1]: ^ 2019-11-17T08:44:42.918959+00:00 app[web.1]: 2019-11-17T08:44:42.918961+00:00 app[web.1]: 2019-11-17T08:44:42.918963+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T08:44:42.918965+00:00 app[web.1]: 2019-11-17T08:44:42.918967+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:44:42.918969+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T08:44:42.918971+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T08:44:42.918973+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T08:44:42.918975+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T08:44:42.918977+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T08:44:42.918979+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T08:44:42.918981+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T08:44:42.918983+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T08:44:42.918985+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T08:44:42.918988+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:44:42.918989+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:44:42.918991+00:00 app[web.1]: raise value 2019-11-17T08:44:42.918994+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T08:44:42.918996+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T08:44:42.918998+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T08:44:42.919000+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T08:44:42.919002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T08:44:42.919004+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:44:42.919006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:44:42.919008+00:00 app[web.1]: raise value 2019-11-17T08:44:42.919010+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T08:44:42.919012+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T08:44:42.919014+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T08:44:42.919016+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T08:44:42.919018+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T08:44:42.919020+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T08:44:42.919022+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T08:44:42.919025+00:00 app[web.1]: return list(self) 2019-11-17T08:44:42.919027+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T08:44:42.919028+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T08:44:42.919031+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T08:44:42.919033+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T08:44:42.919035+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T08:44:42.919037+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T08:44:42.919039+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T08:44:42.919041+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T08:44:42.919043+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T08:44:42.919046+00:00 app[web.1]: distilled_params, 2019-11-17T08:44:42.919048+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T08:44:42.919050+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T08:44:42.919052+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T08:44:42.919054+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T08:44:42.919056+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T08:44:42.919058+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T08:44:42.919060+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T08:44:42.919063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T08:44:42.919074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:44:42.919077+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:44:42.919079+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:44:42.919081+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:44:42.919083+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T08:44:42.919085+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:44:42.919087+00:00 app[web.1]: ^ 2019-11-17T08:44:42.919088+00:00 app[web.1]: 2019-11-17T08:44:42.919091+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T08:44:42.919094+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T08:44:42.919096+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T08:44:42.919234+00:00 app[web.1]: 10.5.225.117 - - [17/Nov/2019:08:44:42 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T08:44:42.918749+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=c195162e-6529-4fb0-9aac-1d9dd9a450e8 fwd="58.182.174.147" dyno=web.1 connect=1ms service=7ms status=500 bytes=244 protocol=https 2019-11-17T09:02:25.748890+00:00 app[web.1]: [2019-11-17 09:02:25 +0000] [12] [ERROR] Error handling request / 2019-11-17T09:02:25.748917+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:02:25.748921+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:02:25.748923+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:02:25.748932+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:02:25.748934+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:02:25.748936+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T09:02:25.748939+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:02:25.748943+00:00 app[web.1]: ^ 2019-11-17T09:02:25.748944+00:00 app[web.1]: 2019-11-17T09:02:25.748947+00:00 app[web.1]: 2019-11-17T09:02:25.748949+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T09:02:25.748950+00:00 app[web.1]: 2019-11-17T09:02:25.748952+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:02:25.748953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T09:02:25.748955+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T09:02:25.748956+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T09:02:25.748958+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T09:02:25.748991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T09:02:25.748994+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T09:02:25.748996+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T09:02:25.748998+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T09:02:25.749000+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T09:02:25.749002+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:02:25.749004+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:02:25.749006+00:00 app[web.1]: raise value 2019-11-17T09:02:25.749008+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T09:02:25.749010+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T09:02:25.749012+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T09:02:25.749014+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T09:02:25.749016+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T09:02:25.749018+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:02:25.749020+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:02:25.749023+00:00 app[web.1]: raise value 2019-11-17T09:02:25.749024+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T09:02:25.749026+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T09:02:25.749027+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T09:02:25.749029+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T09:02:25.749030+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T09:02:25.749032+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T09:02:25.749033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T09:02:25.749036+00:00 app[web.1]: return list(self) 2019-11-17T09:02:25.749038+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T09:02:25.749039+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T09:02:25.749041+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T09:02:25.749042+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T09:02:25.749044+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T09:02:25.749045+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T09:02:25.749047+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T09:02:25.749048+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T09:02:25.749050+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T09:02:25.749051+00:00 app[web.1]: distilled_params, 2019-11-17T09:02:25.749053+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T09:02:25.749054+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T09:02:25.749056+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T09:02:25.749057+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T09:02:25.749059+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T09:02:25.749060+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T09:02:25.749062+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T09:02:25.749063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T09:02:25.749074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:02:25.749076+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:02:25.749078+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:02:25.749080+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:02:25.749082+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T09:02:25.749084+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:02:25.749087+00:00 app[web.1]: ^ 2019-11-17T09:02:25.749089+00:00 app[web.1]: 2019-11-17T09:02:25.749092+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T09:02:25.749094+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T09:02:25.749096+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T09:02:25.749271+00:00 app[web.1]: 10.69.244.94 - - [17/Nov/2019:09:02:25 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T09:02:25.755053+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=181975e4-7c78-4f7f-b131-4b1ddb544e02 fwd="58.182.174.147" dyno=web.1 connect=0ms service=92ms status=500 bytes=244 protocol=https 2019-11-17T09:06:00.663577+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=571550f7-554b-42d0-b127-0a4837f6aae9 fwd="58.182.174.147" dyno=web.1 connect=1ms service=17ms status=500 bytes=244 protocol=https 2019-11-17T09:06:00.661593+00:00 app[web.1]: [2019-11-17 09:06:00 +0000] [11] [ERROR] Error handling request / 2019-11-17T09:06:00.661619+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:06:00.662439+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:06:00.662443+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:06:00.662447+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:06:00.662449+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:06:00.662452+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T09:06:00.662455+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:06:00.662457+00:00 app[web.1]: ^ 2019-11-17T09:06:00.662459+00:00 app[web.1]: 2019-11-17T09:06:00.662461+00:00 app[web.1]: 2019-11-17T09:06:00.662464+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T09:06:00.662466+00:00 app[web.1]: 2019-11-17T09:06:00.662471+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:06:00.662473+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T09:06:00.662476+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T09:06:00.662478+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T09:06:00.662480+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T09:06:00.662483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T09:06:00.662486+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T09:06:00.662488+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T09:06:00.662491+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T09:06:00.662493+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T09:06:00.662495+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:06:00.662498+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:06:00.662500+00:00 app[web.1]: raise value 2019-11-17T09:06:00.662502+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T09:06:00.662505+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T09:06:00.662507+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T09:06:00.662509+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T09:06:00.662511+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T09:06:00.662513+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:06:00.662515+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:06:00.662517+00:00 app[web.1]: raise value 2019-11-17T09:06:00.662519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T09:06:00.662521+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T09:06:00.662523+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T09:06:00.662526+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T09:06:00.662528+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T09:06:00.662530+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T09:06:00.662532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T09:06:00.662535+00:00 app[web.1]: return list(self) 2019-11-17T09:06:00.662537+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T09:06:00.662539+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T09:06:00.662541+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T09:06:00.662544+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T09:06:00.662546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T09:06:00.662548+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T09:06:00.662550+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T09:06:00.662552+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T09:06:00.662555+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T09:06:00.662557+00:00 app[web.1]: distilled_params, 2019-11-17T09:06:00.662559+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T09:06:00.662562+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T09:06:00.662564+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T09:06:00.662566+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T09:06:00.662568+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T09:06:00.662570+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T09:06:00.662573+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T09:06:00.662575+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T09:06:00.662587+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:06:00.662590+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:06:00.662592+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:06:00.662594+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:06:00.662596+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T09:06:00.662599+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:06:00.662601+00:00 app[web.1]: ^ 2019-11-17T09:06:00.662603+00:00 app[web.1]: 2019-11-17T09:06:00.662607+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T09:06:00.662609+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] ```
yolo3 使用convert.py报错,TypeError: buffer is too small for requested array
Traceback (most recent call last): File "convert.py", line 262, in <module> _main(parser.parse_args()) File "convert.py", line 143, in _main buffer=weights_file.read(weights_size * 4)) TypeError: buffer is too small for requested array 请大佬指导
ceilometer通过swift获取监控项失败
我搭建了一个openstack环境(newton版本),包括 keystone,swift,ceilometer 等.运行起来以后发现central.log 中有错误信息,如下: ceilometer.agent.manager [-] Polling pollster storage.objects.size in the context of meter_source ceilometer.agent.manager [-] Continue after error from storage.objects.size: 'str' object has no attribute 'id' Traceback (most recent call last): ... ceilometer.agent.manager File "/usr/lib/python2.7/site-packages/ceilometer/objectstore/swift.py", line 94, in _get_account_info ceilometer.agent.manager yield (t.id, getattr(swift, api_method) ceilometer.agent.manager AttributeError: 'str' object has no attribute 'id' 请高手指点如何解决。
IDLE import torch报错:SyntaxError: invalid syntax
>>> import torch Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import torch File "C:\Python\Python37\torch.py", line 2 t.abs? ^ SyntaxError: invalid syntax >>> ``` ```
python3.5.0安装lxml,导入lxml.html和lxml.etree出错
系统是win7,安装的是python3.5.0版本,lxml安装的是lxml-3.7.1-cp35-cp35m-win_amd64.whl(通过pip安装的)。安装成功后import lxml没有报错,但import lxml.html 和 lxml.etree时就报错了,报错信息如下: >>> import lxml.html Traceback (most recent call last): File "<pyshell#11>", line 1, in <module> import lxml.html File "C:\Program Files\Python 3.5\lib\site-packages\lxml\html\__init__.py", line 54, in <module> from .. import etree File "type.pxd", line 9, in init lxml.etree (src\lxml\lxml.etree.c:220742) ValueError: builtins.type has the wrong size, try recompiling. Expected 840, got 864 >>> import lxml.etree Traceback (most recent call last): File "<pyshell#13>", line 1, in <module> import lxml.etree File "type.pxd", line 9, in init lxml.etree (src\lxml\lxml.etree.c:220742) ValueError: builtins.type has the wrong size, try recompiling. Expected 840, got 864
python引用问题:from wx.lib.pubsub import Publisher
在模块开始加入 from wx.lib.pubsub import Publisher 报错: Traceback (most recent call last): File "G:\learning\python\python_workspace\test_QQ\src\test\test2.py", line 15, in <module> from wx.lib.pubsub import Publisher ImportError: cannot import name Publisher 网上搜了好久,信息好少! 不知道怎么办,求大神指导!
python新手问题:这个类实例化总报错
class Turtle: def _init_(self,x): self.num = x class Fish: def _init_(self,x): self.num = x class Pool: def _init_(self,x,y): self.turtle = Turtle(x) self.fish = Fish(y) def print_num(self): print ("本池塘共有%d只乌龟,有%d条鱼",(self.turtle.num,self.fish.num)) 运行和报错: >>> pool=Pool(1,10) Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> pool=Pool(1,10) TypeError: Pool() takes no arguments >>> pool=Pool() >>> pool.print_num() Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> pool.print_num() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\complexDemo.py", line 17, in print_num print ("本池塘有%d只乌龟,有%d条鱼",(self.turtle.num,self.fish.num)) AttributeError: 'Pool' object has no attribute 'turtle' ps:好烦啊,不知道什么原因,和源代码一模一样,查了很多教程都是这样没报错,为啥我的会报错,求大神指点下
flask教程数据库部分报错
http://www.pythondoc.com/flask-mega-tutorial/database.html#id2 按照这个教程上db_migrate.py的代码 运行之后报错 Traceback (most recent call last): File "./db_migrate.py", line 11, in <module> script = api.make_update_script_for_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, tmp_module.meta, db.metadata) AttributeError: 'module' object has no attribute 'meta'
rabbitmq server启动报错
rabbitmq安装好后启动报 Traceback (most recent call last): File "/usr/lib/command-not-found", line 21, in <module> from CommandNotFound.util import crash_guard ImportError: No module named 'CommandNotFound' python3.5
openstack创建实例成功但是启动实例报错
以下是nova报错详情: ``` /var/log/nova/nova-compute.log:2020-02-11 08:43:18.893 1327 ERROR nova.virt.libvirt.guest [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] Error launching a defined domain with XML: <domain type='kvm'> /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Instance failed to spawn /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Traceback (most recent call last): /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2218, in _build_resources /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] except Exception: /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2064, in _build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] # saved in that function to prevent races. /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 2779, in spawn /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] block_device_info=block_device_info) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4923, in _create_domain_and_network /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] xml, pause=pause, power_on=power_on) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4854, in _create_domain /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] guest.launch(pause=pause) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 142, in launch /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] self._encoded_xml, errors='ignore') /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] self.force_reraise() /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] six.reraise(self.type_, self.value, self.tb) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 137, in launch /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] return self._domain.createWithFlags(flags) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] result = proxy_call(self._autowrap, f, *args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] rv = execute(f, *args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] six.reraise(c, e, tb) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] rv = meth(*args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] libvirtError: 内部错误:qemu unexpectedly closed the monitor: 2020-02-11T00:43:18.668387Z qemu-kvm: -drive file=/var/lib/nova/instances/a26fb462-a721-45eb-8eaa-776ec5da3b23/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/a26fb462-a721-45eb-8eaa-776ec5da3b23/disk': Permission denied /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Unexpected build failure, not rescheduling build. /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Traceback (most recent call last): /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1926, in _do_build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2116, in _build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] exception.ImageNotActive, /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128) /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] ``` dashboard报错: ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581385833_715215.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581385890_574951.png) 网上说了很多办法都没有用,个人初学小白,有没有路过的大神指点一二。万分感谢!
python中使用connector链接mysql时报错
Traceback (most recent call last): File "D:/mysql_demo/demo.py", line 1, in <module> import mysql.connector File "D:\Python文件夹\lib\site-packages\mysql\connector\__init__.py", line 41, in <module> import dns.resolver ModuleNotFoundError: No module named 'dns' z
openstack启动实例报错No valid host was found
计算节点的nova错误日志: ``` 2020-02-11 17:05:07.817 1295 ERROR nova.virt.libvirt.guest [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] Error launching a defined domain with XML: <domain type='kvm'> 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Instance failed to spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Traceback (most recent call last): 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2229, in _build_resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] yield resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2075, in _build_and_run_instance 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 2779, in spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4923, in _create_domain_and_network 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] xml, pause=pause, power_on=power_on) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4854, in _create_domain 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] guest.launch(pause=pause) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 142, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self._encoded_xml, errors='ignore') 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self.force_reraise() 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(self.type_, self.value, self.tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 137, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] return self._domain.createWithFlags(flags) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] result = proxy_call(self._autowrap, f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = execute(f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(c, e, tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = meth(*args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] libvirtError: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] ``` 控制节点的nova-conductor.log ``` 2020-02-11 17:05:08.365 958 ERROR nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Error from last host: compute (node compute): [u'Traceback (most recent call last):\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1937, in _do_build_and_run_instance\n filter_properties)\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2127, in _build_and_run_instance\n instance_uuid=instance.uuid, reason=six.text_type(e))\n', u"RescheduledException: Build of instance 8020d30b-33ec-4836-8f61-f23516aa2508 was re-scheduled: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied\n"] 2020-02-11 17:05:08.450 958 WARNING nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Setting instance to ERROR state. ``` dashboard上报错 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412785_788625.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581413291_261638.png) 我的网络配置是 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412842_430142.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412854_59896.png) 不知道有没有路过的大师指导这是什么原因啊,在网上找了好多方法没有解决。万分感谢!
An error ocurred while starting the kernel
正常安装anaconda后打开spyder,右下角控制台出现错误警告; Github上说程序添加进防火墙和杀毒软件,试过了还是无法解决,不知道有没有遇到同样问题的大佬是怎么解决的,请告知我一声,万分感谢! Versions Spyder version: 3.3.3 Python version: 3.7.2 Qt version: 5.9.7 PyQt version: 5.9.2 Operating System name/version: windows 7 IPython >=4.0 : 7.3.0 (OK) cython >=0.21 : 0.29.6 (OK) jedi >=0.9.0 : 0.13.3 (OK) matplotlib >=2.0.0: 3.0.3 (OK) nbconvert >=4.0 : 5.4.1 (OK) numpy >=1.7 : 1.16.2 (OK) pandas >=0.13.1 : 0.24.2 (OK) pycodestyle >=2.3 : 2.5.0 (OK) pyflakes >=0.6.0 : 2.1.1 (OK) pygments >=2.0 : 2.3.1 (OK) pylint >=0.25 : 2.3.1 (OK) qtconsole >=4.2.0 : 4.4.3 (OK) rope >=0.9.4 : 0.12.0 (OK) sphinx >=0.6.6 : 1.8.5 (OK) sympy >=0.7.3 : 1.3 (OK) ``` An error ocurred while starting the kernel The error is: Traceback (most recent call last): File "C:\Anaconda3\lib\site‑packages\traitlets\traitlets.py", line 528, in get value = obj._trait_values[self.name] KeyError: 'context' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1554, in create_kernel_manager_and_kernel_client kernel_manager.start_kernel(stderr=stderr_handle) File "C:\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 261, in start_kernel self._connect_control_socket() File "C:\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 210, in _connect_control_socket self._control_socket = self.connect_control() File "C:\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 571, in connect_control return self._create_connected_socket('control', identity=identity) File "C:\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 543, in _create_connected_socket sock = self.context.socket(socket_type) File "C:\Anaconda3\lib\site‑packages\traitlets\traitlets.py", line 556, in __get__ return self.get(obj, cls) File "C:\Anaconda3\lib\site‑packages\traitlets\traitlets.py", line 535, in get value = self._validate(obj, dynamic_default()) File "C:\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 42, in _context_default return zmq.Context.instance() File "C:\Anaconda3\lib\site‑packages\zmq\sugar\context.py", line 108, in instance cls._instance = cls(io_threads=io_threads) File "zmq/backend/cython/context.pyx", line 49, in zmq.backend.cython.context.Context.__cinit__ zmq.error.ZMQError: Bad address ```
关于celery启动任务时报错Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 13',)
我使用celery定时器执行任务,可启动时会出现这个错误 ``` [2019-10-22 09:13:30,334: INFO/MainProcess] Connected to redis://127.0.0.1:6379/14 [2019-10-22 09:13:30,361: INFO/MainProcess] mingle: searching for neighbors [2019-10-22 09:13:30,532: INFO/Beat] beat: Starting... [2019-10-22 09:13:31,072: ERROR/Beat] Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 13',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 899, in body for _ in self._process_result(1.0): # blocking File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 864, in _process_result ready, task = poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1370, in _poll_result if self._outqueue._reader.poll(timeout): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 996, in wait return _poll(object_list, timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 13 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 504, in run return self.body() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 904, in body self.finish_at_shutdown() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 953, in finish_at_shutdown if not outqueue._reader.poll(): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 991, in wait return _poll(object_list, 0) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 13 [2019-10-22 09:13:31,408: INFO/MainProcess] mingle: all alone [2019-10-22 09:13:31,423: INFO/MainProcess] celery@iZwz9h41nalpsqzz57x4tmZ ready. ``` 重启几次这个错误就不会出现,但运行一段时间后再次从定时器发布任务时还会出现该错误导致任务执行失败 ``` [2019-10-22 07:00:00,000: INFO/Beat] Scheduler: Sending due task monitoring_auto_run (run.monitoring_auto_run) [2019-10-22 07:00:00,008: INFO/MainProcess] Received task: run.monitoring_auto_run[469ee195-3e1a-4bf0-a7cb-783232e8d0bc] [2019-10-22 07:00:00,105: ERROR/ForkPoolWorker-11] Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 14',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 504, in run return self.body() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 899, in body for _ in self._process_result(1.0): # blocking File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 864, in _process_result ready, task = poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1370, in _poll_result if self._outqueue._reader.poll(timeout): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 996, in wait return _poll(object_list, timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 14 [2019-10-22 07:00:00,768: ERROR/MainProcess] Process 'ForkPoolWorker-11' pid:15068 exited with 'exitcode 1' [2019-10-22 07:00:11,186: ERROR/MainProcess] Task handler raised error: WorkerLostError('Worker exited prematurely: exitcode 1.',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1267, in mark_as_worker_lost human_status(exitcode)), billiard.exceptions.WorkerLostError: Worker exited prematurely: exitcode 1. ```
Linux+pytorch下运行报错RuntimeError: PyTorch was compiled without NumPy support
我在尝试实现Github上开源的代码[Relation-Shape-CNN](https://github.com/Yochengliu/Relation-Shape-CNN ""),运行报错RuntimeError: PyTorch was compiled without NumPy support train_cls.py:36: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(f) ************************** [workers]: 4 [num_points]: 1024 [num_classes]: 40 [batch_size]: 32 [base_lr]: 0.001 [lr_clip]: 1e-05 [lr_decay]: 0.7 [decay_step]: 21 [epochs]: 200 [weight_decay]: 0 [bn_momentum]: 0.9 [bnm_clip]: 0.01 [bn_decay]: 0.5 [evaluate]: 1 [val_freq_epoch]: 0.5 [print_freq_iter]: 20 [input_channels]: 0 [relation_prior]: 1 [checkpoint]: [save_path]: cls [data_root]: /media/lab/16DE307A392D4AED/zs ************************** /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:113: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. init(xyz_raising.weight) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:115: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(xyz_raising.bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:122: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. init(mapping_func1.weight) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:123: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. init(mapping_func2.weight) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:125: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(mapping_func1.bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:126: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(mapping_func2.bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:131: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. init(cr_mapping.weight) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pointnet2_modules.py:132: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(cr_mapping.bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pytorch_utils/pytorch_utils.py:153: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_. init(self.conv_avg.weight) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pytorch_utils/pytorch_utils.py:155: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(self.conv_avg.bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pytorch_utils/pytorch_utils.py:201: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(self[0].weight, 1.0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pytorch_utils/pytorch_utils.py:202: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(self[0].bias, 0) /media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/models/../utils/pytorch_utils/pytorch_utils.py:400: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(fc.bias, 0) Traceback (most recent call last): File "train_cls.py", line 167, in <module> main() File "train_cls.py", line 91, in main train(train_dataloader, test_dataloader, model, criterion, optimizer, lr_scheduler, bnm_scheduler, args, num_batch) File "train_cls.py", line 101, in train for i, data in enumerate(train_dataloader, 0): File "/home/lab/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 336, in __next__ return self._process_next_batch(batch) File "/home/lab/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "/home/lab/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/lab/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 106, in <listcomp> samples = collate_fn([dataset[i] for i in batch_indices]) File "/media/lab/16DE307A392D4AED/zs/Relation-Shape-CNN/data/ModelNet40Loader.py", line 55, in __getitem__ label = torch.from_numpy(self.labels[idx]).type(torch.LongTensor) RuntimeError: PyTorch was compiled without NumPy support 请大神解答!!!
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
JSON解析——net.sf.json.JSONObject
简介 在程序开发过程中,在参数传递,函数返回值等方面,越来越多的使用JSON。JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,同时也易于机器解析和生成、易于理解、阅读和撰写,而且Json采用完全独立于语言的文本格式,这使得Json成为理想的数据交换语言。 JSON建构于两种结构: “名称/值”对的集合(A Collection of name/va...
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
2019年还剩1天,我从外包公司离职了
这日子过的可真快啊,2019年还剩1天,外包公司干了不到3个月,我离职了
我一个37岁的程序员朋友
周末了,人一旦没有点事情干,心里就瞎想,而且跟几个老男人坐在一起,更容易瞎想,我自己现在也是 30 岁了,也是无时无刻在担心自己的职业生涯,担心丢掉工作没有收入,担心身体机能下降,担心突...
计算机网络的核心概念
这是《计算机网络》系列文章的第二篇文章 我们第一篇文章讲述了计算机网络的基本概念,互联网的基本名词,什么是协议以及几种接入网以及网络传输的物理媒体,那么本篇文章我们来探讨一下网络核心、交换网络、时延、丢包、吞吐量以及计算机网络的协议层次和网络攻击。 网络核心 网络的核心是由因特网端系统和链路构成的网状网络,下面这幅图正确的表达了这一点 那么在不同的 ISP 和本地以及家庭网络是如何交换信息的呢?...
python自动下载图片
近日闲来无事,总有一种无形的力量萦绕在朕身边,让朕精神涣散,昏昏欲睡。 可是,像朕这么有职业操守的社畜怎么能在上班期间睡瞌睡呢,我不禁陷入了沉思。。。。 突然旁边的IOS同事问:‘嘿,兄弟,我发现一个网站的图片很有意思啊,能不能帮我保存下来提升我的开发灵感?’ 作为一个坚强的社畜怎么能说自己不行呢,当时朕就不假思索的答应:‘oh, It’s simple. Wait for me for a ...
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
讲真,这两个IDE插件,可以让你写出质量杠杠的代码
周末躺在床上看《拯救大兵瑞恩》 周末在闲逛的时候,发现了两个优秀的 IDE 插件,据说可以提高代码的质量,我就安装了一下,试了试以后发现,确实很不错,就推荐给大家。 01、Alibaba Java 代码规范插件 《阿里巴巴 Java 开发手册》,相信大家都不会感到陌生,其 IDEA 插件的下载次数据说达到了 80 万次,我今天又贡献了一次。嘿嘿。 该项目的插件地址: https://github....
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
程序员如何通过造轮子走向人生巅峰?
前言:你所做的事情,也许暂时看不到成果。但不要灰心,你不是没有成长,而是在扎根。 程序员圈经常流行的一句话:“不要重复造轮子”。在计算机领域,我们将封装好的组件、库,叫做轮子。因为它可以拿来直接用,直接塞进我们的项目中,就能实现对应的功能。 有些同学会问,人家都已经做好了,你再来重新弄一遍,有什么意义?这不是在浪费时间吗。 殊不知,造轮子是一种学习方式,能快速进步,造得好,是自己超强能力的表...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试一个ArrayList我都能跟面试官扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
立即提问

相似问题