Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106689

Re: Python 3.4 problem with requests module

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Python 3.4 problem with requests module
Date 2016-04-09 02:24 +1000
Message-ID <mailman.92.1460132703.2253.python-list@python.org> (permalink)
References <cf3f3eab-6d8d-49d4-932a-b3905f5bac53@googlegroups.com> <CAPTjJmr9AkWiJKKPWtHMz89pDmLb4HdRmChWDUxVxwe-ch5nqA@mail.gmail.com>

Show all headers | View raw


On Sat, Apr 9, 2016 at 2:00 AM,  <1leefig@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python 3.4 problem with requests module 1leefig@gmail.com - 2016-04-08 09:00 -0700
  Re: Python 3.4 problem with requests module Chris Angelico <rosuav@gmail.com> - 2016-04-09 02:24 +1000
  Re: Python 3.4 problem with requests module Steven D'Aprano <steve@pearwood.info> - 2016-04-09 02:27 +1000
  Re: Python 3.4 problem with requests module Chris Angelico <rosuav@gmail.com> - 2016-04-09 04:27 +1000

csiph-web