-
Notifications
You must be signed in to change notification settings - Fork 2
Description
A batch file calls a Python script. Within this Python script a JSON file is loaded in the following way:
json_preprocessor.jsonLoad("./file.jsonp")
Expected is that the path of the executed Python script is the reference for the relative path to the loaded JSON file.
In opposite to this expectation the JsonPreprocessor uses the current working directory. The current working directory depends on the position of the batch file. Therefore this solution only works if batch file and Python script are placed in the same folder. This cannot be assumed in every case and this also should not be a requirement.
CRQ: It has to be coded explicitely, that the path to the executed Python script is the reference for all relative paths, used inside this script.
Proposal:
The line
jFile = CString.NormalizePath(jFile)
has to be replaced by
jFile = CString.NormalizePath(jFile, sReferencePathAbs=os.path.dirname(sys.argv[0]))
This solves the problem.
Metadata
Metadata
Assignees
Labels
Projects
Status