Python 3.4 problem with requests module

Chris Angelico rosuav at gmail.com
Fri Apr 8 12:24:54 EDT 2016


On Sat, Apr 9, 2016 at 2:00 AM, <1leefig at gmail.com> wrote:
> from socket import _fileobject, timeout, error as SocketError
>> But I get a python exception on this last line:
>> ImportError was unhandled by user code
> Message: cannot import name '_fileobject'
>>> I am running Python 3.4 and had no problems previously.

This looks like a shadowed import problem. Try running this:
import socket
print(socket.__file__)
If all's well, you should get a file path that points to your Python
installation (for me, "/usr/local/lib/python3.6/socket.py"). If it
tells you something about your current directory, check for a file
called socket.py or socket.pyc and rename or delete it - you've
shadowed the standard library module.
ChrisA


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /