Page 1 of 1

[Windows] [Python] Some help parsing variables into python

Posted: February 7th, 2012, 9:30 am
by Mikie
Hi, I have a python script I want to run as a post processing script. Is it possible to run it in windows directly form sabnzbd or do I have to go via a .bat file? If its possible to run it directly it would be great becuase then I would have to do anything extra/less when running on unix systems. Could you please explain which is the best way to run it and how do parse the sabnzbd variables into python so they can be used in both windows and unix. Thanks!

Re: [Windows] [Python] Some help parsing variables into pyth

Posted: February 7th, 2012, 11:01 am
by shypike
If you let the Python installer properly register the .py extension, you're OK.
The ActiveState Python MSI installers do this.
You can check it by examining the PATHEXT environment variable.

How to process parameters is general Python knowledge and platform independent.

Code: Select all

import sys
print sys.argv
sys.argv is a list of parameters, starting with 0. 0 will give you the name of the script.