berkona / linktastic

Truly platform-independent file linking
1 stars 1 forks source link

IOError: Parameter format not correct #1

Open jkaberg opened 11 years ago

jkaberg commented 11 years ago

Get this error while trying to create a link with linktastic

03:15:14|INFO Creating hard link for files from F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA to F:/Downloaded/_automated/test/process/tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA. Traceback (most recent call last): File "C:\Downloaders\nzbToMedia\torrenttomedia.py", line 197, in linktastic.link(source, target) File "C:\Downloaders\nzbToMedia\linktastic.py", line 60, in link _link_windows(src, dest) File "C:\Downloaders\nzbToMedia\linktastic.py", line 36, in _link_windows raise IOError(err.output.decode('utf-8')) IOError: Parameter format not correct - "Downloaded".

You know why this is happening?

berkona commented 11 years ago

Think it's related to spaces. I'll look into how to escape the input

"Joel Kåberg" notifications@github.com wrote:

Get this error while trying to create a link with linktastic

03:15:14|INFO Creating hard link for files from F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA to F:/Downloaded/_automated/test/process/tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA. Traceback (most recent call last): File "C:\Downloaders\nzbToMedia\torrenttomedia.py", line 197, in

linktastic.link(source, target) File "C:\Downloaders\nzbToMedia\linktastic.py", line 60, in link _link_windows(src, dest) File "C:\Downloaders\nzbToMedia\linktastic.py", line 36, in _link_windows raise IOError(err.output.decode('utf-8')) IOError: Parameter format not correct - "Downloaded". --- Reply to this email directly or view it on GitHub: https://github.com/berkona/linktastic/issues/1

Sent from my Android phone with K-9 Mail. Please excuse my brevity.

berkona commented 11 years ago

I just created a solution for escaping input. Try pulling the HEAD and replace linktastic.py in nzbToMedia. Once we know the IOError is resolved, I'll update the library in nzbToMedia and create a new pull.

jkaberg commented 11 years ago

Yeah that perhaps solved something, but now I got another one

C:\Windows\system32>python C:\Downloaders\nzbToMedia\torrenttomedia.py F:\Downlo aded_automated\test\complete\tv 8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA 03:35:25|INFO TorrentToMedia V4.3 03:35:25|INFO 3 03:35:25|INFO Script called from Transmission 03:35:25|INFO Loading config from C:\Downloaders\nzbToMedia\autoProcessMedia.cfg 03:35:25|INFO Found torrent directory F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA in category directory F:\Downloaded_automated\test\complete\tv 03:35:25|INFO Determined Category to be: tv 03:35:25|INFO Found media files 03:35:25|INFO Creating hardlink for files from F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA to F:/Downloaded/_automated/test/process/tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA. Traceback (most recent call last): File "C:\Downloaders\nzbToMedia\torrenttomedia.py", line 200, in linktastic.link(source, target) File "C:\Downloaders\nzbToMedia\linktastic.py", line 65, in link _link_windows(src, dest) File "C:\Downloaders\nzbToMedia\linktastic.py", line 41, in _link_windows raise IOError(err.output.decode('utf-8')) IOError: Filnavnet, mappenavnet eller volumnavnesyntaksen er feil.

The last part translates to "Filename, foldername or volume name syntax is wrong"

berkona commented 11 years ago

I don't think that is an issue with the library. See the log line right before the Trace:

03:35:25|INFO Creating hardlink for files from F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA to
F:/Downloaded/_automated/test/process/tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA.

The source is a valid path, but the destination uses / for part of the path, and the valid \ for other. I would check the code that's calling it and see if there's path operations that aren't going through os.path or something.

jkaberg commented 11 years ago

Yeah that was my bad, manually put that in but it throws the same error when I call it from transmission, here's a log 04:01:42|INFO TorrentToMedia V4.3 04:01:42|INFO Script called from Transmission 04:01:42|DEBUG Received Directory: F:/Downloaded/_automated/test/complete/tv 04:01:42|DEBUG Received Torrent Name: Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 04:01:42|INFO Loading config from C:/Downloaders/nzbToMedia\autoProcessMedia.cfg 04:01:42|INFO Found torrent directory F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV in category directory F:/Downloaded/_automated/test/complete/tv 04:01:42|INFO Determined Category to be: tv 04:01:42|DEBUG scanning files in directory: F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 04:01:42|INFO Found media files 04:01:42|DEBUG Destination directory already exists, F:/Downloaded/_automated/test/process/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 04:01:42|INFO Creating hardlink for files from F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV to F:/Downloaded/_automated/test/process/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV.

Same error as my last post 2 up

Geting very late where I am, going to push my changes to my github. If your up for it maybe you can check the code, otherwise I'm gonna go at it tomrrow

clinton-hall commented 11 years ago

In the autoprocess media.cfg you need to specify the destination with "\" not "/" for windows. Also, I suspect the batch file you are using to call TorrentToMedia.py from Transmission is also passing this directory differently? It should be passed with "\"

clinton-hall commented 11 years ago

@berkona Is there a way I can include your repo in my project? I know RuudBurger includes subliminal etc in CouchPotatoServer. The advantage being that any updates made in your repo would be applied to my repo automatically...

jkaberg commented 11 years ago

10:38:35|INFO TorrentToMedia V4.3 10:38:35|INFO Script called from Transmission 10:38:35|DEBUG Received Directory: F:/Downloaded/_automated/test/complete/tv 10:38:35|DEBUG Received Torrent Name: Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 10:38:35|INFO Loading config from C:\Downloaders\nzbToMedia\autoProcessMedia.cfg 10:38:35|INFO Found torrent directory F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV in category directory F:/Downloaded/_automated/test/complete/tv 10:38:35|INFO Determined Category to be: tv 10:38:35|DEBUG scanning files in directory: F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 10:38:35|INFO Found media files 10:38:35|DEBUG Destination directory already exists, F:\Downloaded_automated\test\process\tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV 10:38:35|INFO Creating hardlink for files from F:/Downloaded/_automated/test/complete/tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV to F:\Downloaded_automated\test\process\tv\Agent.Anna.S01E03.720p.HDTV.x264-FiHTV.

Same error as 5 post up, "Filename, foldername or volume name syntax is wrong"

All slashes that I can configure is now passed as \, still same error. Maybe its the output from Transmission as it outputs as so; F:/Downloaded/_automated/test/complete/

clinton-hall commented 11 years ago

Looks like an issue with Transmission running in windows.... Worth reporting on transmission forums?

Anyway... We should be able to convert...

Essentially, if OS = nt we Replace / with \ in Directory.

About to hear to bed... If you don't find a solution I'll see if I can have a crack at it tomorrow.

jkaberg commented 11 years ago

I've cirumvented (right word? :) that issue (Transmission) by using os.path.normpath(), which should sanitize all input

https://github.com/jkaberg/nzbToMedia/blob/master/TorrentToMedia.py#L33 https://github.com/jkaberg/nzbToMedia/blob/master/TorrentToMedia.py#L35 https://github.com/jkaberg/nzbToMedia/blob/master/TorrentToMedia.py#L71

But no closer to fixing this =\

Here's a more recent debug log

"Executing nzbToMedia..." 19:32:16|INFO TorrentToMedia V4.3 19:32:16|INFO Loading config from C:\Downloaders\nzbToMedia\autoProcessMedia.cfg 19:32:16|INFO Received Directory: F:\Downloaded_automated\test\complete\tv | Name: 8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA 19:32:16|INFO Found torrent directory: F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA 19:32:16|INFO Determined category to be: tv 19:32:16|INFO Found media files 19:32:16|INFO Creating hardlink from: F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo to: F:\Downloaded_automated\test\process\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo Traceback (most recent call last): File "C:\Downloaders\nzbToMedia\TorrentToMedia.py", line 193, in linktastic.link(target, source) File "C:\Downloaders\nzbToMedia\linktastic.py", line 65, in link _link_windows(src, dest) File "C:\Downloaders\nzbToMedia\linktastic.py", line 41, in _link_windows IOError: Filename, foldername or volume name syntax is wrong.

berkona commented 11 years ago

Just out of curiosity, what version of windows are you running?

berkona commented 11 years ago

As for including the latest changes, what about Braid

jkaberg commented 11 years ago

Im using Windows 8 at my test machine

The strange thing is when I run this manually from cmd, it works fine (just copy paste soruce and target)

C:\Windows\system32>cmd /C mklink /H F:\Downloaded_automated\test\process\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo Hardlink created for F:\Downloaded_automated\test\process\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo <<===>> F:\Downloaded_automated\test\complete\tv\8.Out.Of.10.Cats.S15E05.720p.HDTV.x264-TLA\8.out.of.10.cats.s15e05.720p.hdtv.x264-tla.nfo

Dont be fooled by the missing \ in F:\Downloaded_automated\, thats an github bug. I actully got them in there when running it ;)

clinton-hall commented 11 years ago

This modification works: def _link_windows(src, dest): try: subprocess.call('cmd ' + '/C ' + 'mklink ' + '/H ' + _escape_param(dest) + ' ' + _escape_param(src)) except: print "failed"

This actually prints Hardlink cretaed for xyz.mkv <<===>> xyz.mkv

this was just a quick fix... hopefully it helps narrow down on what is wrong.

As you see, the output is confirmation of the link. and I have got this working by using subprocess.call and adding a space after each item being passed.