I am trying to import an API key from a python file and I get this error:
ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_27940\425884591.py in
9
10 # Import the OpenWeatherMap's API key
---> 11 from config import weather_api_key
ImportError: cannot import name 'weather_api_key' from 'config' (C:\Users\mjrm_\anaconda3\envs\PythonData\lib\site-packages\config_init_.py)
I have done many fixes that I found but I keep getting this error.
I tried changing the py file name and also attempted verifiy loading different packages into my environment, I feel like the error fix is simple but I cannot figure this out
Related
I am doing a fake news detection as a college project and have written a crawler program for crawling a webpage for information. But when I try to import the crawler into another program it is giving an error of module not found. I am not able to understand how to resolve this issue. I have copied the error here
ModuleNotFoundError Traceback (most recent call last)
in
2 import os
3 from sklearn.utils import shuffle
----> 4 import crawler
5 LEN=2
ModuleNotFoundError: No module named 'crawler'
It's throwing error for this. I am working on Python to query from Snowflake and it's on a MAC OS.
import snowflake.connector as sf
from config import config
conn =sf.connect(user=config.username,password=config.password,account=config.account)
Error is following.
"/Users/xxxxxx/Snowflake Project/bin/python" "/Users/xxxxxx/PycharmProjects/Snowflake Project/Snowflake_selectrecord.py"
Traceback (most recent call last):
File "/Users/xxxxxx/PycharmProjects/Snowflake Project/Snowflake_selectrecord.py", line 2, in <module>
from config import config
ImportError: cannot import name 'config' from 'config' (/Users/xxxxxx/PycharmProjects/Snowflake Project/config.py)
Process finished with exit code 1
I am new to Python and not able to get away with the error. I searched forums and didn't get a reply that solved my error.
Config.py:
username='xxxxx'
password=''
account='xxxxxxxedo.us-east-1'
warehouse= 'reporting_wh'
database='reporting_nonprod'
I am getting "ModuleNotFoundError" when importing a python file.PFB the code:
testImport.ipynb
feet_in_miles=5280
meters_in_kilometer=1000
beatles=["John Lenon","PAul McCartney",""]
Modules.ipynb:
import testImport
print(testImport.beatles)
On running Modules.ipynb, I am getting the below error:
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import testImport
2 print(testImport.beatles)
ModuleNotFoundError: No module named 'testImport'
Kindly let me know what's the issue.
check in your directory that testImport.py is in the folder where you are running the code . New program should be in same directory
I am scratching my hairs and trying to find out why I am always having such error.
I have sybpydb installed on my laptop (win 7 professional) in c drive: C:\FAST\anaconda\python27\win64\431\Lib\site-packages\, as per below:
enter image description here
I had set the path to that location: C:\FAST\anaconda\python27\win64\431\Lib\site-packages\, as per below:
enter image description here
But whenever I try to import sybpydb, i am always getting this error message:
>>> import sybpydb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sybpydb`
I was googling and treid the suggested steps:-
https://wiki.scn.sap.com/wiki/display/SYBCON/Debugging+Error+messages+with+python+samples
Python error "ImportError: No module named") but no avail, would anyone has come across this before please?
I installed third party module and its egg file was created in following path
D:\Utkarsh\Lib\site-packages
I am not getting error while importing module in IDLE in following way
import snakebite
When i am importing the same in HDFS.py file having following lines
import snakebite
from snakebite.client import Client
client = Client('localhost', 9000)
it causes following stack error:
============ RESTART: D:/Utkarsh/Python Projects/HDFS.py ============
Traceback (most recent call last):
File "D:/Utkarsh/Python Projects/HDFS.py", line 1, in <module>
import snakebite
ModuleNotFoundError: No module named 'snakebite'
sys.path had following values:
D:/Utkarsh/Python Projects
D:\Utkarsh\Installation\Lib\idlelib
D:\Utkarsh\Installation\python36.zip
D:\Utkarsh\Installation\DLLs
D:\Utkarsh\Installation\lib
D:\Utkarsh\Installation
D:\Utkarsh\Installation\lib\site-packages
Being newbie,can anybody help me in knowing exact cause of it.