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

Persistent errors: Windows error (123) and max() arg is empty sequence #29

Closed
d8sconz opened this issue Jul 29, 2014 · 7 comments
Closed

Comments

@d8sconz
Copy link

d8sconz commented Jul 29, 2014

I'm using Win XP, SP3. This old girl runs on hamsters. Still, she can handle most python scripts. Here's what I've done so far: Uninstalled and reinstalled all of the elements needed including Python27. I have uninstalled all other Pythons. I have checked all the environment variables and pointed the scripts to my ffmpg installation. I have gone through the videogrep script and removed all unnecessary white space and standardised the tabs (to tabs, then to spaces). When I run the script it finds the .srt file, then the .mp4 file. In my example search ...

(python -m pdb d:\videogrep-master\videogrep.py --input "E:\Movies\TheMatrix\The_Matrix.mp4" --search "JJ NNS" --search-type pos)

... it finds 24 instances of the search term. Notice that I am running this through pdb. 24 results means that the script calls create_supercut_in_batches(). create_supercut_in_batches() then calls create_supercut() inside a try/except block which in turn calls demo_supercut() whose sole function seems to be to print out the details of each clip (start, end, line). All this works fine and I get the list printed to my screen for the first 20 clips, and then again for the next 4 clips. This is where I'm lost. All of this is happening inside the try/except block in create_supercut_in_batches(). What isn't happening are any of the commands in the try block that follow the call to create_supercut(). Here's the code:

while start_index < total_clips:
        filename = outputfile + '.tmp' + str(start_index) + '.mp4'
        try:
            create_supercut(composition[start_index:end_index], filename, padding)
            batch_comp.append(filename)
            gc.collect()
            start_index += batch_size
            end_index += batch_size
        except:
            start_index += batch_size
            end_index += batch_size
            next

So, none of this gets done:

            batch_comp.append(filename)
            gc.collect()
            start_index += batch_size
            end_index += batch_size

...which means, in turn, that batch_comp is an empty set. The next command following the while loop (inside of which is the try/except block above) calls moviepy:

clips = [VideoFileClip(filename) for filename in batch_comp]

... but batch-comp is an empty set, thus (I guess) generating the max() args error.

Sorry to be so long-winded, but this is an issue that others are having too and this is my best shot at it so far. The problem is I'm stumped. Why don't the commands that follow the call to create_supercut() in the try block get actioned? As I say, I've checked all the white spaces and the tabs etc. I've placed break points on those lines and they just don't get triggered.

Any help, please.

@d8sconz
Copy link
Author

d8sconz commented Jul 29, 2014

Further:

The problem seems to be that the try block fails and falls through to the except block. It fails within create_supercut() at the point that moviepy is called:

videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])

The call to VideoFileClip() is also what throws the Windows(123) error, so my suspicion now falls on moviepy.

@Zulko
Copy link

Zulko commented Jul 29, 2014

Can you paste the whole error that occurs when you remove the try block ?

@d8sconz
Copy link
Author

d8sconz commented Jul 29, 2014

Hi Zulko, Here is the error message I get when I perform a search that returns fewer than the max clips threshold. This just means that I bypass the create_supercut_in_batches() function and it's try/except block.

  File "videogrep.py", line 261, in <module>
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, arg
s.maxclips, args.padding, args.test, args.randomize, args.sync)
  File "videogrep.py", line 241, in videogrep
    create_supercut(composition, outputfile, padding
  File "videogrep.py", line 86, in create_supercut
    videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])
  File "D:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 5
5, in **init**
    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt
  File "D:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 1
  7, in **init**
    infos = ffmpeg_parse_infos(filename, print_infos)
  File "D:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 2
  07, in ffmpeg_parse_infos
    stderr=sp.PIPE)
  File "D:\Python27\lib\subprocess.py", line 710, in **init**
    errread, errwrite)
  File "D:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect     

I have to call it quits for tonight. Tomorrow I want to follow the process through ffmpeg where I'm beginning to think the problem lies..

Thanks for your interest.

@d8sconz
Copy link
Author

d8sconz commented Jul 30, 2014

Hi Zulko, Here is the error message I get when I perform a search that returns fewer than the max clips threshold. This just means that I bypass the create_supercut_in_batches() function and it's try/except block.

Traceback (most recent call last):
  File "videogrep.py", line 261, in <module>
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, arg
s.maxclips, args.padding, args.test, args.randomize, args.sync)
  File "videogrep.py", line 241, in videogrep
    create_supercut(composition, outputfile, padding
  File "videogrep.py", line 86, in create_supercut
    videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])
  File "D:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 5
5, in __init__
    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt
  File "D:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 1
  7, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos)
  File "D:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 2
  07, in ffmpeg_parse_infos
    stderr=sp.PIPE)
  File "D:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "D:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect     

Thanks for your interest.

@Zulko
Copy link

Zulko commented Jul 30, 2014

It seems like a file name issue... strange.

@d8sconz
Copy link
Author

d8sconz commented Jul 30, 2014

Man, that was a mission! I've finally cracked it (chest puffed, superior expression...)

at the beginning of videogrep.py, and the appropriate place in conf.py (for moviepy), where you indicate your path to ffmpeg and IMAGEMAGICK_BINARY, place an 'r' immediately before the opening quote. For example, on my (Windows) machine, in conf.py:

FFMPEG_BINARY = r'D:\ffmpeg\bin\ffmpeg'
IMAGEMAGICK_BINARY = r'D:\ImageMagick\convert'

...and in videogrep.py

FFMPEG_BINARY = r'D:\ffmpeg\bin\ffmpeg'

(note the leading r)

This inputs a raw string and stops python from shagging around with double backslashes etc (I think). Maybe the instructions can be amended?

@Zulko
Copy link

Zulko commented Jul 30, 2014

Yes they will be ! Thanks a bunch !

@d8sconz d8sconz closed this as completed Jul 31, 2014
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