Results 1 to 3 of 3
I'm just starting to program, and I'm using Python 2.5 on Ubuntu. I made a file for my programs under my home file. However, when I try to import my ...
- 05-29-2007 #1
Python - where do I put my programs file in Linux?
I'm just starting to program, and I'm using Python 2.5 on Ubuntu. I made a file for my programs under my home file. However, when I try to import my programs, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named chaos
>>>
I'm 99% sure I need to put my programs in the Python directory somehow, but I'm not sure how.
Currently, the program is at:
danbuter\pythonprogs\chaos.py
Python is installed at:
usr\lib\python2.5
I tried to create a new file there, but it wouldn't let me. Even if I do, I am not sure if it needs to be in one of the subdirectories or should be directly after python2.5. I'm assuming I'll need to use a sudo command to accomplish this.
Can anyone tell me what I need to do so that python will import my programs? Thanks!Dan
- 05-29-2007 #2
6. Modules
As a rule of thumb, don't use root unless you have to.Flies of a particular kind, i.e. time-flies, are fond of an arrow.
Registered Linux User #408794
- 05-29-2007 #3Linux User
- Join Date
- Aug 2006
- Posts
- 458
you can add your python progs path in sys.path in your script
Code:import sys sys.path.append("/your/python/prog/path") import yourprog


Reply With Quote