I have looked everywhere for this and just cannot find the answer. I have checked my python version and it is version 3.2 . When I try to import cookielib
I receive:
ImportError: No module named cookielib
I have seen that in Python 3.0 it was renamed to
http.cookiejar
and that it would auto import cookielib
.
I thought that maybe there was some wild error in my python configuration so I thought I should try and import http.cookiejar
like this import http.cookiejar
. That did not work all and I get and error:
EOFError: EOF read where not expected
.
This is not the error I had expected becuase import http.cookies
imports just fine.
Does anybody have a solution to this problem? What am I overlooking?
Full Error:
Traceback (most recent call last):
File "C:\Users\Spencer\Downloads\selenium-2.20.0.tar\selenium-2.20.0\selenium-2.20.0\test", line 1, in <module>
import urllib.request, urllib.parse, http.cookiejar
EOFError: EOF read where not expected
The automatic renaming business only applies if you use 2to3. Therefore, you have to import http.cookiejar
.
The error EOFError: EOF read where not expected
is only ever thrown by Python marshalling. Most likely, this is caused by a race condition fixed in Python 3.3, where multiple processes tried to write concurrently to the pyc file. Deleting all .pyc files may be a workaround.
try:
import cookielib
except:
import http.cookiejar
cookielib = http.cookiejar
The cookielib
module has been renamed to http.cookiejar
in Python 3.0. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With