ImportError: cannot import namedtuple name

I have a python script that causes the following error on startup:

import urllib2
File "C:\Python27\lib\urllib2.py", line 94, in <module>
import httplib
File "C:\Python27\lib\httplib.py", line 73, in <module>
from urlparse import urlsplit
File "C:\Python27\lib\urlparse.py", line 119, in <module>
from collections import namedtuple
ImportError: cannot import name namedtuple

I also use the package openpyxllocated in the folder C: \ Python27 \ Lib \ site-packages, which contains the folder collectionswith the file __init__.py. I realized that this is causing this problem because it may interfere with importing the python 2.7 assembler module.

What can I do to fix this problem?

+4
source share
1 answer

This can also happen if your local script contains a “collection” module due to the way Python handles relative and absolute imports.

+8
source

All Articles