Capturing output during a post-processing script

Come up with a useful post-processing script? Share it here!
Post Reply
dilorc
Newbie
Newbie
Posts: 3
Joined: April 10th, 2010, 1:52 pm

Capturing output during a post-processing script

Post by dilorc »

Hi,

I have a python script that I am trying to run.  It runs fine when I run it from the shell.  However, it's not doing anything when SABnzbd+ starts it.  The script is being executed but it appears to just keep running and running forever.  When I try to look at the script output, I get an error of "Request unsuccessful".  Is there a way to look at the output of the script in realtime?  A file that I can tail in the background while it runs?  There is a situation where the script could be stuck waiting for input from a user and I want to make sure it's not entering this state.

I've written a short python script that dumps the arguments out and that works fine.  This script doesn't appear to be doing anything :(

Thanks for the help
dilorc
Newbie
Newbie
Posts: 3
Joined: April 10th, 2010, 1:52 pm

Re: Capturing output during a post-processing script

Post by dilorc »

When I run the script from the shell, I run it as ./tvdb.py 'arg' 2 ''  The single quotes are included on the command line because they have spaces in them.  I don't provide all 6 arguments because I only need the 1st and 3rd.

The first line of the script is #!/usr/bin/python.

Here's the log entry where the script is starting:

Code: Select all

2010-04-10 00:58:02,889::INFO::[newsunpack:126] Running external script /home/dilorc/SABnzbd/scripts/tvdb.py(/home/dilorc/SABnzbd/complete/Supernatural S05E16 720p HDTV x264 SiTV, Supernatural S05E16 720p HDTV x264 SiTV.nzb, Supernatural S05E16 720p HDTV x264 SiTV, , None, alt.binaries.teevee, 0)
The only thing that seems to be an error is this:

Code: Select all

Request Headers:
  AUTHORIZATION: Basic ZGlsb3JjOmNvbGxlZW4x
  REFERER: http://<deleted>.no-ip.info:8080/sabnzbd/
  HOST: dilorenzo.no-ip.info:8080
  CACHE-CONTROL: max-age=0
  X-REQUESTED-WITH: XMLHttpRequest
  ACCEPT: text/html, */*
  ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.366.2 Safari/533.4
  CONNECTION: keep-alive
  COOKIE: histPerPage=9999999; Plush2Refresh=30; mythweb_id=6lm27bo52e5bsvpuf6dnbgppe4; Plush2AddNZB=block; show_filter=true; session_id=f8f1e40014b756f8b339d5ec450466f63f96c75a
  Remote-Addr: 192.168.0.1
  ACCEPT-LANGUAGE: en-US,en;q=0.8
  ACCEPT-ENCODING: gzip,deflate,sdch
2010-04-10 00:59:15,408::DEBUG::[_cplogging:55] [10/Apr/2010:00:59:15] HTTP Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/cherrypy/_cprequest.py", line 618, in respond
    cherrypy.response.body = self.handler()
  File "/usr/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/share/sabnzbdplus/sabnzbd/interface.py", line 910, in scriptlog
    return ShowString(history_db.get_name(name), history_db.get_script_log(name))
  File "/usr/share/sabnzbdplus/sabnzbd/database.py", line 265, in get_name
    return self.c.fetchone()['name']
TypeError: 'NoneType' object is unsubscriptable
I think this is me requesting the non-existent script output.
dilorc
Newbie
Newbie
Posts: 3
Joined: April 10th, 2010, 1:52 pm

Re: Capturing output during a post-processing script

Post by dilorc »

I figured out what the problem was.  I made a bad assumption about what the working directory was when a post-processing script is run.  I thought it was the directory where the script is located...it's not.  For me, it was /usr/bin.  Because of that, it forced my script into a function where it needed user input.
Post Reply