Sneitzke38 Sneitzke38 - 1 year ago 178
Python Question

Python 3.2 won't import cookielib

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

I receive:

ImportError: No module named cookielib

I have seen that in Python 3.0 it was renamed to
and that it would auto import

I thought that maybe there was some wild error in my python configuration so I thought I should try and import
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.