Add directory to sys.path based on variable
loial
jldunn2000 at gmail.com
Thu Jan 30 09:03:39 EST 2014
Ok, that works fine with the apth hard coded, but I want to do something like the code below. i.e I am trying to dynamically add a path that is relative to the path of the current executing python script.
In this case the import fails.
import sys
import os
from os.path import *
scriptpath=os.path.dirname(sys.argv[0])
otherscriptspath=printerpath.replace("scripts","otherscripts")
sys.path.append(otherscriptspath)
from AuditUpdate import *
More information about the Python-list
mailing list