I am trying to run the remote manager example code from the multiprocessing documentation in pypy3 but I get an error connecting the client.
Traceback (most recent call last):
File "C:/temp/testpypy/mp_client.py", line 7, in <module>
m.connect()
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\managers.py", line 455, in connect
conn = Client(self._address, authkey=self._authkey)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 493, in Client
answer_challenge(c, authkey)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 732, in answer_challenge
message = connection.recv_bytes(256) # reject large message
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 386, in _recv
buf.write(chunk)
TypeError: 'str' does not support the buffer interface
if I try to connect to it from a CPython interpreter (which is my ultimate goal) I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\managers.py", line 455, in connect
conn = Client(self._address, authkey=self._authkey)
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 493, in Client
answer_challenge(c, authkey)
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 737, in answer_challenge
response = connection.recv_bytes(256) # reject large message
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 218, in recv_bytes
self._bad_message_length()
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 151, in _bad_message_length
raise OSError("bad message length")
OSError: bad message length
Turns out to be a bug in PyPy3.
Here is the fixed ticket:
https://bitbucket.org/pypy/pypy/issues/2841/remote-multprocessing-issue#comment-45861347
Related
I have experience running pymysql because it always return
the following error
Traceback (most recent call last):
File "synch.py", line 69, in <module>
db = pymysql.connect(host='localhost',user='root',password='mypassword',db='mytable',charset='utf8')
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect
return Connection(*args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 327, in __init__
self.connect()
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 587, in connect
self._get_server_information()
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 976, in _get_server_information
self.server_version = data[i:server_end].decode('latin1')
LookupError: unknown encoding: latin1
In Python, to share data between different process by using multiprocessing, we use multiprocessing.Manager(). I want to get output [1,2,3,4,5,6,7,8,9,10] in the following code, but I am getting EOFError. Why?
The Code is:
import multiprocessing
manager=multiprocessing.Manager()
final_list=manager.list()
input_list_one=[1,2,3,4,5]
input_list_two=[6,7,8,9,10]
def worker(data):
for item in data:
final_list.append(item)
process_1=multiprocessing.Process(target=worker,args=[input_list_one])
process_2=multiprocessing.Process(target=worker,args=[input_list_two])
process_1.start()
process_2.start()
process_1.join()
process_2.join()
print(final_list)
I am getting the following error:
Process SyncManager-1:
Traceback (most recent call last):
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 539, in _run_server
server = cls._Server(registry, address, authkey, serializer)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 139, in __init__
self.listener = Listener(address=address, backlog=16)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 438, in __init__
self._listener = SocketListener(address, family, backlog)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 576, in __init__
self._socket.bind(address)
PermissionError: [Errno 13] Permission denied
Traceback (most recent call last):
File "/storage/emulated/0/qpython/.last_tmp.py", line 2, in <module>
manager=multiprocessing.Manager()
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/context.py", line 56, in Manager
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 517, in start
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 250, in recv
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 407, in _recv_bytes
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 383, in _recv
EOFError
1|u0_a823#land:/ $
i have this code in python2.7 for upload photos.zip file on the server via ftp.
import ftplib
session = ftplib.FTP('server.address.com','USERNAME','PASSWORD')
file = open('c:\archived\photos.zip','rb') # file to send
session.storbinary('STOR photos.zip', file) # send the file
file.close() # close file and FTP
session.quit()
but i have this error :
raceback (most recent call last):
File "a.py", line 24, in <module>
file = open('c:\archived\photos.zip','rb')
IOError: [Errno 22] invalid mode ('rb') or filename: 'c:\archived\photos.zip'
also I used this solution :
file = open(os.path.join('c:/','archived','photos.zip'),'rb')
but I get this error :
Traceback (most recent call last):
File "s.py", line 28, in <module>
session.storbinary('s.zip', file)
File "C:\Users\0xuser\Anaconda2\lib\ftplib.py", line 479, in storbinary
conn = self.transfercmd(cmd, rest)
File "C:\Users\0xuser\Anaconda2\lib\ftplib.py", line 378, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "C:\Users\0xuser\Anaconda2\lib\ftplib.py", line 341, in ntransfercmd
resp = self.sendcmd(cmd)
File "C:\Users\0xuser\Anaconda2\lib\ftplib.py", line 251, in sendcmd
return self.getresp()
File "C:\Users\0xuser\Anaconda2\lib\ftplib.py", line 226, in getresp
raise error_perm, resp
ftplib.error_perm: 500 Unknown command.
Try using forward slashes :
file = open('c:/archived/photos.zip','rb') # file to send
Hi I'm using pyftpsync in order to upload new images (downloaded every day) in a online store skipping the existing ones.
From the author site I'm using this code (with my personal data of course):
from ftpsync.targets import FsTarget
from ftpsync.ftp_target import FtpTarget
from ftpsync.synchronizers import UploadSynchronizer
local = FsTarget("~/temp")
user ="joe"
passwd = "secret"
remote = FtpTarget("/temp", "example.com", username=user, password=passwd)
opts= {"force": False, "delete_unmatched": True, "verbose": 3, "dry_run" : False}
s = UploadSynchronizer(local, remote, opts,tls=True)
s.run()
This work for me correctly only if I delete the tls option, otherwise I obtain this error while connecting to my server:
Traceback (most recent call last):
File "sync.py", line 25, in <module>
s.run()
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/synchronizers.py", line 139, in run
res = self._sync_dir()
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/synchronizers.py", line 416, in _sync_dir
remote_entries = self.remote.get_dir()
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/ftp_target.py", line 310, in get_dir
self.ftp.retrlines("MLSD", _addline)
File "/usr/lib/python3.4/ftplib.py", line 466, in retrlines
resp = self.sendcmd('TYPE A')
File "/usr/lib/python3.4/ftplib.py", line 272, in sendcmd
return self.getresp()
File "/usr/lib/python3.4/ftplib.py", line 235, in getresp
resp = self.getmultiline()
File "/usr/lib/python3.4/ftplib.py", line 221, in getmultiline
line = self.getline()
File "/usr/lib/python3.4/ftplib.py", line 209, in getline
raise EOFError
EOFError
Could not remove lock file: Underlying socket connection gone (_ssl.c:1570)
Exception ignored in: <bound method FtpTarget.__del__ of <ftpsync.ftp_target.FtpTarget object at 0x7fe397ae7710>>
Traceback (most recent call last):
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/targets.py", line 70, in __del__
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/ftp_target.py", line 153, in close
File "/media/luca/1E9C3E629C3E349D/luca/Documenti/attività/Cataloghi2/ftpsync/ftp_target.py", line 187, in _unlock
File "/usr/lib/python3.4/ftplib.py", line 613, in delete
File "/usr/lib/python3.4/ftplib.py", line 271, in sendcmd
File "/usr/lib/python3.4/ftplib.py", line 198, in putcmd
File "/usr/lib/python3.4/ftplib.py", line 193, in putline
File "/usr/lib/python3.4/ssl.py", line 720, in sendall
File "/usr/lib/python3.4/ssl.py", line 681, in send
ssl.SSLError: Underlying socket connection gone (_ssl.c:1570)
It's obviously a problem related to the encryption, but I don't know how to fix it.
I have a setup containing varnish nginx and 2 pyramid backends one of them running socket.io app. All the stack works correctly on my local development computer, but i can't get to work the websocket part on the production computer. The traceback of the error that trows the socketio app when a client socket.io tries to connect:
[2012-11-20 14:32:00] "GET /socket.io/1/websocket/790777701707 HTTP/1.1" 101 - -
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 226, in send_into_ws
websocket.send(message)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 350, in send
return self.send_frame(message, self.OPCODE_TEXT)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 340, in send_frame
self._write(combined)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 515, in sendall
data_sent += self.send(_get_memory(data, data_sent), flags, timeout=timeleft)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 483, in send
return sock.send(data, flags)
error: [Errno 32] Broken pipe
<Greenlet at 0xa449c0c: send_into_ws> failed with error
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 230, in read_from_ws
message = websocket.receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 296, in receive
result = self._receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 244, in _receive
frame = self.receive_frame()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 177, in receive_frame
data0 = read(2)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/python_fixes.py", line 22, in readinto
return self._sock.recv_into(b)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 472, in recv_into
wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 169, in wait_read
switch_result = get_hub().switch()
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/hub.py", line 164, in switch
return greenlet.switch(self)
timeout: timed out
<Greenlet at 0xa46157c: read_from_ws> failed with timeout
I've checked all python packages versions and there are identical in both computers. Also upgraded production computer to libevent 1.4.14b to match local computer.
I don't know which way to go to debug this. Help appreciated!