Advertisement

Monday, November 11, 2013

Fixed Python Environment Variable Problem

I spent some time working on the python code for the HESA program tonight.  I want to have a sub-folder called modules to store re-usable code.  That way, I can have program code in its own folder without duplicating functions.

Up until now, when I tried to import code from the modules folder, it would not find the file.  I finally figured out how to change the path environment variable so the program finds the module files.

Here is the code.

# Load libraries 
import sys 
sys.path.append('/home/pi/python/modules') 

After this the import command will look for files in the current folder and the modules folder.

No comments:

Post a Comment