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

Come up with a useful post-processing script? Share it here!
Post Reply
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

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

Post 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!
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

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

Post 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.
Post Reply