- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Impala-shell encounters ImportError when pwd contains python file whose name conflict with module
- Labels:
-
Apache Impala
Created on ‎06-07-2017 11:00 PM - edited ‎09-16-2022 04:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When we execute impala-shell command at a directory contains user defined python script, and the script name conflicts with python module imported by impala-shell, we will encounter an Import Error.
How to reproduce:
- create abc.py
$ touch abc.py
- execute impala-shell:
$ impala-shell 'import site' failed; use -v for traceback Traceback (most recent call last): File "/usr/lib/impala-shell/impala_shell.py", line 24, in <module> import getpass File "/usr/lib64/python2.6/getpass.py", line 18, in <module> import os, sys, warnings File "/usr/lib64/python2.6/os.py", line 398, in <module> import UserDict File "/usr/lib64/python2.6/UserDict.py", line 82, in <module> import _abcoll File "/usr/lib64/python2.6/_abcoll.py", line 11, in <module> from abc import ABCMeta, abstractmethod ImportError: cannot import name ABCMeta
Created ‎06-12-2017 10:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either workaround it or submit a request or submit your change back to the Apache Impala project.
Created ‎06-08-2017 07:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yep confirmed in the Python docs. Well it is Python 3; should still be correct for Python 2.6 or 2.7.
https://docs.python.org/3/tutorial/modules.html#the-module-search-path
Created ‎06-08-2017 07:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created on ‎06-08-2017 08:56 PM - edited ‎06-08-2017 08:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not putting python script under /usr/bin, but my working directory.
For example, If someone else I don't known who write a python script under home directory:
[~]$ cat abc.py #!/usr/bin/python
print "test script"
Now I cannot execute impala-shell anymore due to Import Error:
[~]$ impala-shell test script 'import site' failed; use -v for traceback Traceback (most recent call last): File "/usr/lib/impala-shell/impala_shell.py", line 24, in <module> import getpass File "/usr/lib64/python2.6/getpass.py", line 18, in <module> import os, sys, warnings File "/usr/lib64/python2.6/os.py", line 398, in <module> import UserDict File "/usr/lib64/python2.6/UserDict.py", line 82, in <module> import _abcoll File "/usr/lib64/python2.6/_abcoll.py", line 11, in <module> from abc import ABCMeta, abstractmethod ImportError: cannot import name ABCMeta
I think impala-shell shall not include current directory in PYTHONPATH to avoid such error.
Created ‎06-12-2017 10:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either workaround it or submit a request or submit your change back to the Apache Impala project.
