hello everyone

i created a python file DailyExpensessave.py

when i need to import this in another python program i was getting this error

> Traceback (most recent call last):
>    File "C:\Python32\DailyExpensessave", line 1, in <module>
>      from DailyExpenses import *
>  ImportError: No module named DailyExpenses 

Both the python files are in the same folder C:\Python32

Recommended Answers

All 6 Replies

Do you have a file named DailyExpenses.py in the same folder. It is case sensitive.

You need a file DailyExpenses.py in a folder that Python usually scans.

yes @vegaseat @ihatehippies both the files in the same folder. checked the name its correct

no module named DailyExpenses, pretty much means what it says. Something is definately wrong with one of the script names/locations. You have DailyExpenses.py or .pyc in the same folder as DailyExpensessave.py ? Not in a subfolder or anything?

# shows a list of directories Python will scan (aka. PYTHONPATH)
# sys.path[0] will be this sript file's directory
import sys

Another option is to make a DailyExpenses.pth text file that contains the directory name where you can find the DailyExpenses.py file. You can save the path file in Python's "site-packages" directory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.