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

Error handling spaces in filenames/paths in Linux #1

Open
jtermi03 opened this issue Sep 17, 2017 · 1 comment
Open

Error handling spaces in filenames/paths in Linux #1

jtermi03 opened this issue Sep 17, 2017 · 1 comment

Comments

@jtermi03
Copy link

jtermi03 commented Sep 17, 2017

Tried to run the script in Linux and got this error for a path that included a space. Removing the space resolved the issue, but I don't want to remove every space in my library.

'root@MediaDrive:/srv/dev-disk-by-label-MediaDrive/Downloads# python conv2mp4-py.py

There are 10 files in the queue:

1: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E07 - Episode 7 WEBDL-1080p.mkv
2: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E02 - Episode 2 WEBDL-1080p.mkv
3: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E06 - Episode 6 WEBDL-720p.mkv
4: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E04 - Episode 4 WEBDL-720p.mkv
5: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E03 - Episode 3 WEBDL-720p.mkv
6: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E08 - Episode 8 WEBDL-720p.mkv
7: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E10 - Episode 10 WEBDL-1080p.mkv
8: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E05 - Episode 5 WEBDL-720p.mkv
9: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E09 - Episode 9 WEBDL-720p.mkv
10: /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E01 - Episode 1 WEBDL-1080p.mkv


09/16/2017 17:29:00 Processing - /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season 3/Narcos - S03E07 - Episode 7 WEBDL-1080p.mkv
09/16/2017 17:29:00 File 1 of 10 - Total queue 10.0%
Argument '3/Narcos' provided as input filename, but '/srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season' was already specified.
Argument '3/Narcos' provided as input filename, but '/srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season' was already specified.
Argument '3/Narcos' provided as input filename, but '/srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Narcos/Season' was already specified.
Traceback (most recent call last):
File "conv2mp4-py.py", line 414, in
codec_discovery()
File "conv2mp4-py.py", line 164, in codec_discovery
get_duration_temp = humanize_time(head)
File "conv2mp4-py.py", line 132, in humanize_time
mins, secs = divmod(int(secs), 60)
ValueError: invalid literal for int() with base 10: '''

Once I removed the spaces, I got another error:

09/16/2017 17:42:57 Processing - /srv/dev-disk-by-label-MediaDrive/Videos/TV_Shows/Rick_and_Morty/Rick_and_Morty_Season_3/Rick_and_Morty_-_S03E02_-_Rickmancing_the_Stone_WEBDL-1080p.mkv 09/16/2017 17:42:57 File 1 of 28 - Total queue 3.57% 09/16/2017 17:42:57 Video: H264 , Audio: EAC3. Encoding audio to AAC Traceback (most recent call last): File "conv2mp4-py.py", line 433, in <module> encode_audio() File "conv2mp4-py.py", line 339, in encode_audio subprocess.Popen(ffmpeg + ff_args, stdout=subprocess.PIPE).stdout.read() File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

@pengee
Copy link

pengee commented Mar 5, 2018

To fix this you need to pass a path surrounded with quotes for both the old_file and new_file into ffmpeg and/or handbrake (I just added & escaped quotes into the path). For the second error, you need to pass an argument of shell=True to subprocess.Popen. I don't use python so I'm not really sure why this is, sounds like it's just the case when passing strings to this call.

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

2 participants