PermissionError: [WinError 5] Åtkomst nekad och/eller TypeError: cannot pickle 'SSLSocket' object

Added by Henrik about 1 month ago

Hejsan,

Jag testar ert Python3 testprogram, men får: "PermissionError: [WinError 5] Åtkomst nekad"
Se nedan. Notera att användare i pathen är borttagen.

Kör jag i IDLE så får jag detta fel: TypeError: cannot pickle 'SSLSocket' object
Oklart för mig vilket som kommer längst i processen.

Men uppstår i detta kodblock: # Start a parallel process that keeps receiving updates from the TCP socket
proc = Process(target=receive_message_from_socket, args=(feed_socket,))
proc.start()

-----------------------------------------------------
C:\My_python_lib>python test_program.py <user> <password>

Checking NEXT API status...
<< HTTP request POST /next/2/login {
"country": "SE",
"environment": "exttest",
"expires_in": 300,
"private_feed": {
"encrypted": true,
"hostname": "priv.api.test.nordnet.se",
"port": 443
},
"public_feed": {
"encrypted": true,
"hostname": "pub.api.test.nordnet.se",
"port": 443
},
"session_key": "57f683f76b3eec050d8189b9d3a935d96db5b646"
}

Connecting to feed pub.api.test.nordnet.se:443...

Traceback (most recent call last):
File "test_program.py", line 214, in <module>
main()
File "test_program.py", line 186, in main
proc.start()
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\context.py", line 224, in Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\popen_spawn_win32.py", line 93, in init
reduction.dump(process_obj, to_child)
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 272, in getstate
raise TypeError(f"cannot pickle {self.
_class__.__name__!r} object")
TypeError: cannot pickle 'SSLSocket' object

C:\My_python_lib>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\spawn.py", line 107, in spawn_main
new_handle = reduction.duplicate(pipe_handle,
File "C:\Users\\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\reduction.py", line 79, in duplicate
return _winapi.DuplicateHandle(
PermissionError: [WinError 5] Åtkomst nekad


Replies (1)

(1-1/1)