Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors with uTorrentPostProcess.py #635

Closed
blackley opened this issue Jan 8, 2017 · 29 comments
Closed

errors with uTorrentPostProcess.py #635

blackley opened this issue Jan 8, 2017 · 29 comments

Comments

@blackley
Copy link

blackley commented Jan 8, 2017

/home/plex/mp4_automator/uTorrentPostProcess.py movie udp://tracker.openbittorrent.com:80/announce /home/plex/torrents/complete/movie/Interstellar.Wars.2016.BRRip.AC3.2.0.x264-BDP[PRiME] multi Interstellar.Wars.2016.BRRip.AC3.2.0.x264-BDP[PRiME].mkv D50DDE62D882A0E85B20DF368B6E936BD40B37F9
import: unable to open image os': Permission denied @ error/blob.c/OpenBlob/2712. import: unable to open image re': Permission denied @ error/blob.c/OpenBlob/2712.
import: unable to open image sys': Permission denied @ error/blob.c/OpenBlob/2712. import: unable to open image shutil': Permission denied @ error/blob.c/OpenBlob/2712.
from: too many arguments
from: too many arguments
from: too many arguments
import: unable to open image logging': Permission denied @ error/blob.c/OpenBlob/2712. from: too many arguments /home/plex/mp4_automator/uTorrentPostProcess.py: line 11: syntax error near unexpected token os.path.join'
/home/plex/mp4_automator/uTorrentPostProcess.py: line 11: `fileConfig(os.path.join(os.path.dirname(sys.argv[0]), 'logging.ini'), defaults={'logfilename': os.path.join(os.path.dirname(sys.argv[0]), 'info.log').replace("\", "/")})'�

@blackley
Copy link
Author

blackley commented Jan 9, 2017

Here is another log entry from utorrent and the errors observed

/home/plex/mp4_automator/uTorrentPostProcess.py tv http://explodie.org:6969/announce /home/plex/torrents/complete/tv/Conviction.S01E11.HDTV.x264-FLEET[PRiME] multi Conviction.S01E11.HDTV.x264-FLEET[PRiME].mkv 48C63CEBA82346C38D1BE6306DC5C8A2F1C49591
from: too many arguments
from: too many arguments
from: too many arguments
from: too many arguments
/home/plex/mp4_automator/uTorrentPostProcess.py: line 11: syntax error near unexpected token os.path.join' /home/plex/mp4_automator/uTorrentPostProcess.py: line 11: fileConfig(os.path.join(os.path.dirname(sys.argv[0]), 'logging.ini'), defaults={'logfilename': os.path.join(os.path.dirname(sys.argv[0]), 'info.log').replace("\", "/")})'

@badincite
Copy link

I just get this

2017-01-11 18:18:01 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-11 18:18:01 - uTorrentPostProcess - ERROR - Not enough command line parameters present, are you launching this from uTorrent?
2017-01-11 18:18:01 - uTorrentPostProcess - ERROR - #Args: %L %T %D %K %F %I %N Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name
2017-01-11 18:18:01 - uTorrentPostProcess - ERROR - Length was 1
2017-01-11 18:18:01 - uTorrentPostProcess - ERROR - []

@mdhiggins
Copy link
Owner

mdhiggins commented Jan 12, 2017 via email

@badincite
Copy link

badincite commented Jan 12, 2017 via email

@mdhiggins
Copy link
Owner

If you try to run a python script from the command line with command line parameters are they appropriately passed?

@badincite
Copy link

badincite commented Jan 12, 2017 via email

@mdhiggins
Copy link
Owner

Hm then its unclear why the command line parameters aren't being passed. Dunno if this is perhaps a bug with uTorrent? I usually recommend anyone using uTorrent switch to Deluge anyway for other reasons but I'm not sure here. The error you're seeing is what you'd expect when the script doesn't recognized any command line arguments being present. I suppose you could try using a batch file to test if uTorrent is passing anything

@badincite
Copy link

I went through the registry and edited everything I could find now I'm seeing Length was 2. I was running deluge at one point but I noticed utorrent was finding more peers then deluge I ran them side by side so I dumped deluge.

2017-01-11 20:11:19 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-11 20:11:19 - uTorrentPostProcess - ERROR - Not enough command line parameters present, are you launching this from uTorrent?
2017-01-11 20:11:19 - uTorrentPostProcess - ERROR - #Args: %L %T %D %K %F %I %N Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name
2017-01-11 20:11:19 - uTorrentPostProcess - ERROR - Length was 2
2017-01-11 20:11:19 - uTorrentPostProcess - ERROR - [' udp://tracker.ilibr.org:6969/announce F:\ single new.girl.s06e12.the.cubicle.720p.web.dl.hevc.x265.rmteam.mkv 6A61A22E8DE733B76759113F2D5B997479B0E25F new.girl.s06e12.the.cubicle.720p.web.dl.hevc.x265.rmteam.mkv']

@blackley
Copy link
Author

I have had the exact same problem on linux - same error message.

@mdhiggins
Copy link
Owner

mdhiggins commented Jan 12, 2017

After looking at the uTorrent forums it seems others have had issues. Try playing around with the double quotes you have in the uTorrent settings and see if that has any impact, like try removing them from around the .py file
D:\Plex\sickbeard_mp4_automator-master\uTorrentPostProcess.py "%L" "%T" "%D" "%K" "%F" "%I" "%N"

Other than that I would maybe seek some assistance on the uTorrent forums to see if there's any known issues.

@blackley
Copy link
Author

blackley commented Jan 12, 2017

Hi Michael,

I did already test double quotes and single quotes and have not been able to make the utorrentpostprocess work at all. Utorrent logs show it passes the correct command line.... if you take the command line passed from the log and run it in terminal you get the errors reported.

Hope this helps...

Cheers,
Darren

@blackley
Copy link
Author

blackley commented Jan 12, 2017

I have resorted to using the manual process and passing variables to it from utorrent... i am in the process of testing my custom script that will be for any torrent or nzb client and uses your manual script.

Cheers,
Darren

@badincite
Copy link

I was able to get further using the suggested utorrent format however nothing seem's to happen after readSettings

2017-01-11 21:09:07 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-11 21:09:07 - readSettings - INFO - C:\Python27\python.exe

@badincite
Copy link

badincite commented Jan 12, 2017

It's passing the parameters to the batch file does length 2 mean its faulting on the tracker parameter?

D:\Plex\sickbeard_mp4_automator-master>'"D:\Plex\sickbeard_mp4_automator-master\Test.bat"'
The filename, directory name, or volume label syntax is incorrect.

D:\Plex\sickbeard_mp4_automator-master>'"postprocessing"'
''"postprocessing"'' is not recognized as an internal or external command,
operable program or batch file.

D:\Plex\sickbeard_mp4_automator-master>'"udp://tracker.coppersurfer.tk:80"'
The filename, directory name, or volume label syntax is incorrect.

D:\Plex\sickbeard_mp4_automator-master>'"F:"'
The filename, directory name, or volume label syntax is incorrect.

D:\Plex\sickbeard_mp4_automator-master>'"single"'
''"single"'' is not recognized as an internal or external command,
operable program or batch file.

D:\Plex\sickbeard_mp4_automator-master>'"The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv"'
''"The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv"'' is not recognized as an internal or external command,
operable program or batch file.

D:\Plex\sickbeard_mp4_automator-master>'"9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C"'
''"9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C"'' is not recognized as an internal or external command,
operable program or batch file.

D:\Plex\sickbeard_mp4_automator-master>'"The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv"
''"The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv"' is not recognized as an internal or external command,
operable program or batch file.

@badincite
Copy link

badincite commented Jan 12, 2017

Nevermind that doesn't make since the log clearly shows it has all the parameters so why is it even throwing the error?'

It has everything
Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name

ERROR - ['postprocessing udp://tracker.coppersurfer.tk:80 F: single The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv 9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv']

@mdhiggins
Copy link
Owner

I'm having a hard time determining where that last error you posted is being triggered from
Is that the full error message? If not can you post the full stack trace

@badincite
Copy link

Here's the full log, It's saying it not enough parameters are present but then list all of the them which is confusing.

2017-01-12 18:59:17 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-12 18:59:17 - uTorrentPostProcess - ERROR - Not enough command line parameters present, are you launching this from uTorrent?
2017-01-12 18:59:17 - uTorrentPostProcess - ERROR - #Args: %L %T %D %K %F %I %N Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name
2017-01-12 18:59:17 - uTorrentPostProcess - ERROR - Length was 2
2017-01-12 18:59:17 - uTorrentPostProcess - ERROR - ['postprocessing udp://tracker.coppersurfer.tk:80 F:\postprocessing single The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv 9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv']

@mdhiggins
Copy link
Owner

So it looks like the individual arguments aren't being split up into the array, and instead are all lumped together as one big item.

You didn't by chance wrap everything in quotes did you? Maybe post a screenshot of your uTorrent 'run program' settings page

@badincite
Copy link

If I change the code (if len(sys.argv) > 6:) to ignore the argument that throws the error it stops at this part in the script I think. Which is the directory parameter (Not familiar with python so I could be wrong)

settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini")
path = str(sys.argv[3])

Log shows
2017-01-12 19:53:37 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-12 19:53:37 - readSettings - INFO - C:\Python27\python.exe

@badincite
Copy link

badincite commented Jan 13, 2017

I've tried it this way

image

And This way both show the same in the log when run

image

Just ran them back to back here is the log

2017-01-12 20:10:02 - uTorrentPostProcess - ERROR - Not enough command line parameters present, are you launching this from uTorrent?
2017-01-12 20:10:02 - uTorrentPostProcess - ERROR - #Args: %L %T %D %K %F %I %N Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name
2017-01-12 20:10:02 - uTorrentPostProcess - ERROR - Length was 2
2017-01-12 20:10:02 - uTorrentPostProcess - ERROR - [' postprocessing udp://tracker.coppersurfer.tk:80 F:\postprocessing single The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv 9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv']
2017-01-12 20:12:11 - uTorrentPostProcess - INFO - uTorrent post processing started.
2017-01-12 20:12:11 - uTorrentPostProcess - ERROR - Not enough command line parameters present, are you launching this from uTorrent?
2017-01-12 20:12:11 - uTorrentPostProcess - ERROR - #Args: %L %T %D %K %F %I %N Label, Tracker, Directory, single|multi, NameofFile(if single), InfoHash, Name
2017-01-12 20:12:11 - uTorrentPostProcess - ERROR - Length was 2
2017-01-12 20:12:11 - uTorrentPostProcess - ERROR - [' postprocessing udp://tracker.coppersurfer.tk:80 F:\postprocessing single The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv 9135445B5CA81D092E3F0A3EF8DD2B30DA80CD6C The.Goldbergs.2013.S04E12.HDTV.x264-FLEET[eztv].mkv']

@mdhiggins
Copy link
Owner

What's happening is your arguments aren't being broken up into a list, and its seeing all of the arguments as one long argument

So when python checks the argument count, its not getting the right number cause all of the 6 arguments uTorrent is passing are only seen as a single entity.

Now why this is happening isn't clear. One thing I would try is wrapping the path to the python file in quotes in addition to the parameters, example

"C:\scripts\uTorrentPostProcess.py" "%L" "%T" "%D" "%K" "%F" "%I" "%N" and see if that makes any impact

The fact that manual. py runs makes me think its not a systemic issue but a problem with how uTorrent is passing the commands

You could also make a simple python file like this

import sys
print "Args: %r" % sys.argv[1:]

And then run the file from the command line with a couple parameters and post the output for me
script.py arg1 arg2 arg3 arg4

@badincite
Copy link

No luck with that format in utorrent

Here is the output

image

@badincite
Copy link

I got it!!!!!!!!!!!!!!!!! it was on my side here is the fix. Thanks for the help

Modifying the following two registries so that the arguments are passed along to Python:

HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
HKEY_CLASSES_ROOT\py_auto_file\shell\open\command
Add %* to the existing "C:\PythonXX\python.exe" "%1", so that the key now looks like: "C:\PythonXX\python.exe" "%1" %*.

Source: http://eli.thegreenplace.net/2010/12/14/problem-passing-arguments-to-python-scripts-on-windows/

@mdhiggins
Copy link
Owner

mdhiggins commented Jan 13, 2017

Awesome. Yeah the last debug script was really helpful in showing that it was a systemic problem.
Glad its working. Hopefully this helps @blackley

@blackley
Copy link
Author

Hey Michael,

I did get it working on Linux - you need to specify the path to python on the utorrent command line - worth updating the doco on this.

@mdhiggins also can you pass a variable to the utorrent post process for the output path? in other words, override the default in the autoprocess.ini? The reason this should be available (if it isn't) is that if you are downloading a tv show you may like to output this to a different path than for a movie and then have the post processors for either movie or tv pick it up... Or can we add 2 paths to the autoprocess.ini - once for movies and one for tv?

@blackley
Copy link
Author

@mdhiggins I have added some updates to the readme.md doco regarding this for your review and approval 👍

@mdhiggins
Copy link
Owner

If you wanna make a pull request I'll merge the readme update into the master branch

@blackley
Copy link
Author

blackley commented Jan 14, 2017 via email

@ikrowni
Copy link

ikrowni commented Mar 11, 2018

Im trying to do the steps outlined by @badincite

HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
HKEY_CLASSES_ROOT\py_auto_file\shell\open\command
Add %* to the existing "C:\PythonXX\python.exe" "%1", so that the key now looks like: "C:\PythonXX\python.exe" "%1" %*.

I cant find HKEY_CLASSES_ROOT\Applications\python.exe in my registry im using python 2.7.14 could anyone help me figure this out?

There is also no HKEY_CLASSES_ROOT\py_auto_file available either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants