Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106688 > unrolled thread
| Started by | 1leefig@gmail.com |
|---|---|
| First post | 2016-04-08 09:00 -0700 |
| Last post | 2016-04-09 04:27 +1000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.python
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
| From | 1leefig@gmail.com |
|---|---|
| Date | 2016-04-08 09:00 -0700 |
| Subject | Python 3.4 problem with requests module |
| Message-ID | <cf3f3eab-6d8d-49d4-932a-b3905f5bac53@googlegroups.com> |
Hi all,
I would appreciate any thoughts that you may have regarding a troublesome build error. I am at my wits end.
For some strange reason a get a single error on importing. It's to do with the requests module and pyopenssl.py
The comment block indicates:
This needs the following packages installed:
* pyOpenSSL (tested with 0.13)
* ndg-httpsclient (tested with 0.3.2)
* pyasn1 (tested with 0.1.6)
I have done this.
The requests module then imports:
from __future__ import absolute_import
try:
from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT
from ndg.httpsclient.subj_alt_name import SubjectAltName as BaseSubjectAltName
except SyntaxError as e:
raise ImportError(e)
import OpenSSL.SSL
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.type import univ, constraint
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.
I am not sure if its to do with the csv fetcher functionality and have tried everything.
Thanks
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-04-09 02:24 +1000 |
| Message-ID | <mailman.92.1460132703.2253.python-list@python.org> |
| In reply to | #106688 |
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
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2016-04-09 02:27 +1000 |
| Message-ID | <5707dc05$0$1612$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #106688 |
On Sat, 9 Apr 2016 02:00 am, 1leefig@gmail.com wrote: > import OpenSSL.SSL > from pyasn1.codec.der import decoder as der_decoder > from pyasn1.type import univ, constraint > 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' If you run this: import socket print(socket.__file__) what does it say? -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-04-09 04:27 +1000 |
| Message-ID | <mailman.97.1460140044.2253.python-list@python.org> |
| In reply to | #106688 |
On Sat, Apr 9, 2016 at 4:24 AM, Lee Fig <1leefig@gmail.com> wrote: > print(socket.__file__) > > seems to confirm that all is well. It refers to my Lib folder: > C:\work\tools\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\Lib\socket.py > > How frustrating. I will Google shadow importing as thats a new one on me. > Please feel free to mention any further thoughts Please respond to the list, so everyone can see things. Did you run that from the exact same place that your imports were failing? Try, immediately after the print call above, "import requests". Does it still fail? ChrisA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web