As stated, mostly the error codes come from the executed script and sys.exit().
The example with a non-existing file as an argument to the interpreter fall in a different category. Though it's stated nowhere I would guess, that these exit codes are the "standard" Linux error codes. There is a module called errno that provides these error numbers (the exit codes come from linux/include/errno.h.
I.e.: errno.ENOENT (stands for for "No such file or directory") has the number 2 which coincides with your example.
As stated, mostly the error codes come from the executed script and sys.exit().
The example with a non-existing file as an argument to the interpreter fall in a different category. Though it's stated nowhere I would guess, that these exit codes are the "standard" Linux error codes. There is a module called errno that provides these error numbers (the exit codes come from linux/include/errno.h.
I.e.: errno.ENOENT (stands for for "No such file or directory") has the number 2 which coincides with your example.
The Python manual states this regarding its exit codes:
Some systems have a convention for assigning specific meanings to specific exit codes, but these are generally underdeveloped; Unix programs generally use 2 for command line syntax errors and 1 for all other kind of errors.
So, since you specified thisfiledoesntexist.py as a command line argument, you get a return code of 2 (assuming the file does not, in fact, exist. In that case I'd recommend renaming it to thisfiledoesexist.py. ;) )
Other that such parsing errors, the return code is determined by the Python program run. 0 is returned unless you specify another exit code with sys.exit. Python itself does not interfere.
Executing Python Script fail with error code 2
Run Command - Python error
Python project, exit code 2
Getting "Process exit code: 2" when running installed Python script in Inno Setup - Stack Overflow
Videos
Hi there!
So short Intro, I am making a python script/project for like a addon to the game "Elite Dangrous", To do this I am using basically a macro to accomplish the task, for those who know this game it's basically a Fleet carrier auto Route plotter for long disctance trips.
The way the script works is it uses 2 librarys called "pyautogui" and "pydirectinput" to navigate the player UI and peform actions.
I decided to make this since i learned how to read csv files in my classes a few weeks ago.
the code runs fine, but the next step is to impliment the script into another program called EDMC(https://github.com/EDCD/EDMarketConnector) , that can run plugins that are fully written in python(https://github.com/EDCD/EDMarketConnector/blob/main/PLUGINS.md) I was asked to make the script a plugin so that more people can use it.
I have spent a few days trying to make it run, but I have now encountered an error that I have no idea how to fix ot troubleshoot.
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe', '-m', 'pip', 'install', 'pydirectinput']' returned non-zero exit status 2.
2021-03-02 14:15:05.670 - ERROR - plug.load_plugins:210: Failure loading found Plugin "FCjumper"
EDMC returns a text file with error codes when it runs and this is the extract, If i should post more of it please let me know and ill give the whole thing.
Here is the link to my Git hub which has the files, It is organized with 2 modules and a load.py file.The load file has the functions required for EDMC to recognise it.
https://github.com/Gorfs/FCAutojumper
i created a new branch REDDIT for yall to see the new files plus the full log for the error, in main there are my previous files, for the files without the EDMC mods, look for the GUI.py, Macro.py and main.py, files in the main branch and run those or alternativly run the FCautojumperandfueller.py to get all the functions in one file.
IF those interested want to try out the code without the plugins bits just call the make_GUI in the load file(make sure that you have all 3 files) and have fun
The second link should have everything required to understand how it works, so If you can understand it, it should give some explanations.
here is the link to a short plugin for EDMC that I am using to understand how to make my own work ,
https://github.com/Exynom/EDMC-HourlyIncome
And also second question would be how would i make it so that It could be its own standalone .exe? whenever I launch the file directly without an IDE it does nothing(when calling the make_GUI ) but when i run it using the IDE it all works? (just a little side question).
Final notes:
I know this is probably a dumb question but after a few hours of looking and only finding things that are WAY to complicated for me to understand i got a bit demotivated. And yes i know this isnt at all good compared to the other plugins, I just wanted to make a little thing to help the comunity out.
Anyway I hope that I didnt just turn people off from helping me with this massive hump of text, (if so, sorry) and of course if anyone wants to use the code to make anything they want you have my full consent, you may edit, copy, distribute as you wish but please add me as a contributor is so. :)
Good day (or night)
P.S if you have any problems seeing the files please comment and ill try to fix it as soon as possible thanks :)
btw if you post a response you are a boss :)
edit1: forgot to say, If anyone here can't figure out what my crappy code means then post in the comments, I'll try to answer question about what I made. :)