Python scripts (for a beginner)

Any questions about the Command Line Interface can be placed here!
Forum rules
Please note the disclaimer before modifying your Synology Product.

Python scripts (for a beginner)

Postby fitshase » Tue May 15, 2012 11:41 pm

I've been given python script files to run on my synology but I have no clue where to start. Basically, I am in the UK and have a Virgin Media TiVo box. Someone on the TiVo forums have managed to get the US TiVo iPad app working by using Python scripts running on a Windows PC (someone has also made an EXE file to make it easier in Windows) but it means the PC has to be on with the EXE running all of the time. I want the Python scripts running on my Synology so I don't have to have the computer on all of the time.

I've installed the python package and managed to telnet into the Synology drive but I am stumpted on what to do next.

Do I need to copy the files into a certain directory?
How do I run the python script I've been given?

I'm a total novice and I've not used Telnet before so please go easy on me :D
fitshase
Novice
Novice
 
Posts: 53
Joined: Wed Nov 16, 2011 1:19 pm

Re: Python scripts (for a beginner)

Postby Goner » Wed May 16, 2012 9:21 am

I'm not a Python expert, but there is a package running on my DS (AutoSub) written in Python and it seems to be started with this command :

Code: Select all
/usr/local/python/bin/python /usr/local/autosub/AutoSub.py -c /usr/local/autosub/config.properties -d -l


So you start the Python executable and give it the script (.py) to run. The rest of the line is specific to AutoSub I think, so just leave it or you might have to replace it with a configuration file your script needs.

If you want to know more, use :
Code: Select all
/usr/local/python/bin/python --help

to see all options/arguments for Python ...

NAS : DS212j with 2 ST2000DL003 in SHR / DSM 4.3-3810
LAN : Fritz!Box 7170, 4 Devolo & 1 Icidu 200Mbps AV homeplugs, 2 5-port switches, ASUS WL-300g
HW : Conceptronic CHD3NET, ACRyan Playon!HD, Eminent EM7075dts, Wii, Wii U, PS2
User avatar
Goner
Seasoned
Seasoned
 
Posts: 552
Joined: Tue Mar 06, 2012 2:27 pm
Location: Rotterdam, Netherlands

Re: Python scripts (for a beginner)

Postby fitshase » Thu May 17, 2012 10:21 am

Thanks Goner.

I'd managed to copy all of the files into the Python folder but I couldn't get python to start. I didn't realise you had to type the full path in for python then the full path for the script!

All working now.

Thanks again. :D
fitshase
Novice
Novice
 
Posts: 53
Joined: Wed Nov 16, 2011 1:19 pm

Re: Python scripts (for a beginner)

Postby devigid » Sat Aug 25, 2012 3:15 pm

What I found was cd'ing to the script.py directory you can then type:


> python script.py

identifying the directory of python is not necessary. However, one must point to the script or program that you wish to run as you have discovered. else, using 'cd' in the console to route to the working directory works to.
:wink:
devigid
I'm New!
I'm New!
 
Posts: 7
Joined: Sat Aug 25, 2012 6:26 am


Return to Command Line Interface

Who is online

Users browsing this forum: No registered users and 0 guests