Skip to content

Error handling spaces in filenames/paths in Linux #1

@jtermi03

Description

@jtermi03

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions