I have a python module called Queue that conflicts with the default queue in python.
While trying to force the import of the default queue, I tried to just clear sys.path.
I understood that import is being viewed from sys.path. But Python can still import modules after clearing syspath.
Explain it please!
In [26]: sys.path Out[26]: [] In [27]: import datetime In [28]: datetime Out[28]: <module 'datetime' from '/usr/local/python2.7/lib/python2.7/lib-dynload/datetime.so'> In [31]: import xyz.Queue In [32]: xyz.Queue Out[32]: <module 'xyz.Queue' from '/public/abc/def/ghi/xyz/Queue/__init__.pyc'> In [33]: sys.path Out[33]: []
Just like importing your own module queue instead of a queue.
I know that refactoring is the solution that this problem deserves, but it is not the one that he needs right now.
source share