Issue
I'm trying to run a post-build python script in Eclipse. By explicitly naming the path to the python script, I am able to get it to run correctly. However, when I attempt to use the Eclipse project variable ${PROJECT_LOC}, it's unable to resolve the correct path.
What I've tried entering, with no success, into the post-build script section of Eclipse's build settings:
python.exe ${PROJECT_LOC}\script.py
Results: can't open file '\script.py: [Errno 2] No such file or directory`
python.exe PROJECT_LOC\script.py
Results: can't open file 'PROJECT_LOC\script.py: [Errno 2] No such file or directory
Again, it works when I explicitly define the path to the script like so:
python.exe C:\somepath\script.py
It seems to not register the eclipse PROJECT_LOC variable. Is it possible to use Eclipse's variables when calling a pre/post-build command?
Solution
I figured out a solution and wanted to post an answer in case others would like to do something similar.
As long as the Python executable location and script location are in your system environment path variable, you can simply add cmd.exe /c MyScript.py in the Eclipse Post-build steps command field located in properties under C/C++ Build -> Settings -> Build Steps.
Answered By - mban
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.