utorrent-postprocess.pyw setup problems

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

utorrent-postprocess.pyw setup problems

Post by N3mam »

Hey there @rednoah

Can you please help me troubleshoot this one ?

I have installed python (x64) on my machine
Calling python --version in cmd displays Python 3.6.3

This is my .pyw script
https://ybin.me/p/42374dd916953b9d#n4WI ... E/BQa3jT0=

in uT run program have url to my utorrent-postprocess.pyw

Code: Select all

"C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" "%L" "%S" "%N" "%K" "%F" "%D"
I think its something trivial, because script won't even start, doesn't matter if i run it from console or from utorrent.

Thank you
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

Re: [Windows] Suppress CMD window

Post by N3mam »

//Update

running script from console does work, only uTorrent doesn't trigger python script
User avatar
rednoah
The Source
Posts: 23955
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Suppress CMD window

Post by rednoah »

What exact command is utorrent executing? Please check the utorrent logger tab for that.
:idea: Please read the FAQ and How to Request Help.
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

Re: [Windows] Suppress CMD window

Post by N3mam »

This is newest log

Code: Select all

[2017-10-30 12:27:10]  Executing: "C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" "TV" "5" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "%K" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "D:\BORDEL"
User avatar
rednoah
The Source
Posts: 23955
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Suppress CMD window

Post by rednoah »

What happens if you run the exact same command in CMD?

Code: Select all

"C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" "TV" "5" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "%K" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "D:\BORDEL"
:idea: Please read the FAQ and How to Request Help.
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

Re: [Windows] Suppress CMD window

Post by N3mam »

Its working:

Code: Select all

python "C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" "TV" "5" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "%K" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "D:\BORDEL"
I already copy this file to this destination manually, hence the failure

Code: Select all

Run script [fn:amc] at [Mon Oct 30 14:14:09 CET 2017]
Parameter: unsorted = y
Parameter: music = n
Parameter: artwork = n
Parameter: movieFormat = Movies/{plex.tail}
Parameter: seriesFormat = TV Shows/{plex.tail}
Parameter: animeFormat = {plex}
Parameter: musicFormat = {plex}
Parameter: ut_label = TV
Parameter: ut_state = 5
Parameter: ut_title = Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv
Parameter: ut_kind = %K
Parameter: ut_file = Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv
Parameter: ut_dir = D:\BORDEL
Bad ut_kind value: %K
Input: D:\BORDEL\Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv
Group: [tvs:star trek discovery] => [Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Star Trek Discovery]
Fetching episode data for [Star Trek: Discovery]
Fetching episode data for [Star Trek: Deep Space Nine]
Skipped [D:\BORDEL\Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv] because [E:\KODI\TV Shows\Star Trek - Discovery\Season 01\Star Trek - Discovery - S01E07 - Magic to Make The Sanest Man Go Mad.mkv] already exists
Processed 0 files
Finished without processing any files
Failure (°_°)
Don't know why utorrent doesnt trigger python
User avatar
rednoah
The Source
Posts: 23955
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Suppress CMD window

Post by rednoah »

This works. Yes?

Code: Select all

python "C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" ...

This does not work. Yes?

Code: Select all

"C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" ...

What happens if you run the command that does not work in CMD? Why did you change the command? Please run the EXACT same command that utorrent is using.


Now we know that python utorrent-postprocess.pyw works, and that that calling utorrent-postprocess.pyw doesn't. That tells us that whatever executable is associated with the *.pyw extension is not the same executable that is associated with the python command. Presumably, you have multiple versions of python installed. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

Re: [Windows] Suppress CMD window

Post by N3mam »

Well, i had python 3.6 x86 installed on my PC, but i uninstalled it before installing newer version 3.6.3 x64

-Anyway i uninstalled and deleted all python files that i can find and installed 3.6.3 x64 again
- Irestarted PC and run command in cmd

This is result
Image
It says - you have no program asociated with this type of extension, install program or associate installed program in control pannel.

when i run python utorrent-postprocess.pyw it works fine

// I associated .pyw with pythonw.exe but it wont start the script, when i associate .pyw with python.exeit will show this

Code: Select all

C:\Users\n3mam>"C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw" "TV" "5" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "%K" "Star.Trek.Discovery.S01E07.Magic.to.Make.The.Sanest.Man.Go.Mad.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv" "D:\BORDEL"
Traceback (most recent call last):
  File "C:\Users\n3mam\Desktop\Plocha\utorrent-postprocess.pyw", line 24, in <module>
    label, state, title, kind, file, directory = sys.argv[1:7]
ValueError: not enough values to unpack (expected 6, got 0)
User avatar
rednoah
The Source
Posts: 23955
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Suppress CMD window

Post by rednoah »

Here's your solution then:

Code: Select all

"path\to\pythonw.exe" "path\to\utorrent-postprocess.pyw" "%L" "%S" "%N" "%K" "%F" "%D"
:idea: Use the executable so you don't have to worry about file type association.

:idea: Use absolute path to the executable so you don't have to worry about the %PATH%.
:idea: Please read the FAQ and How to Request Help.
User avatar
N3mam
Posts: 17
Joined: 18 Oct 2017, 06:09

Re: utorrent-postprocess.pyw setup problems

Post by N3mam »

Thank you rednoah, it is working as expected now.

So all the problems was caused by me, because i didn't check if python was installed in $PATH ?
Or is it possible that windows fall creators update mix things up a little bit.

Anyway thank you for excellent support.
User avatar
rednoah
The Source
Posts: 23955
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: utorrent-postprocess.pyw setup problems

Post by rednoah »

It should just work, on a clean system. But because you had multiple versions of python installed, using different versions depending on how you call the script, you got strange behavior. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply