Import error macOS
Hello, I have been using python3 for several years but have never seen this error. Description: After executing “python3” and starting the cli, I can import the following without error -from cassandra.cluster import Cluster Then I exit and run a .py file whose first line is “from cassandra.cluster import Cluster” which results in the following error. -Traceback (most recent call last): File "cassandra.py", line 1, in <module> from cassandra.cluster import Cluster File "/Users/<user>/Documents/learning/cassandra.py", line 1, in <module> from cassandra.cluster import Cluster ModuleNotFoundError: No module named 'cassandra.cluster'; 'cassandra' is not a package Sure, the import did not work. But the next part is the issue. Now I return back to the cli by executing “python3” and I enter the following (the same as above”) -from cassandra.cluster import Cluster Now I get this error: -Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.
from cassandra.cluster import Cluster Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/<user>/Documents/learning/cassandra.py", line 1, in <module> from cassandra.cluster import Cluster ModuleNotFoundError: No module named 'cassandra.cluster'; 'cassandra' is not a package
The error is referencing the file but I am not executing it. This is very odd. This continues until I close the terminal instance and open a new one and is reproducible if you take the above steps on my system. If you would like further details, please let me know. Thanks, Brent
participants (1)
-
Brent Leeper