Quantcast
Viewing all articles
Browse latest Browse all 4928

Python • Re: Main file @ Desktop/startup import files in Documents

Here is what I use

Code:

import syssys.path.append('/mnt/pi_lib/common') 

Better to use something like the following than use a fixed path:

Code:

import osimport syssys.path.append(os.path.dirname(os.path.abspath(__file__)))

By doing the above as long as the all the files are in the same directory it doesn't matter where that directory is.

Statistics: Posted by thagrol — Thu May 09, 2024 9:01 pm



Viewing all articles
Browse latest Browse all 4928

Trending Articles