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

[BUG] ValueError: [Errno 22] Invalid argument #483

Open
3 of 4 tasks
JoacoAnselmo opened this issue Oct 22, 2024 · 7 comments
Open
3 of 4 tasks

[BUG] ValueError: [Errno 22] Invalid argument #483

JoacoAnselmo opened this issue Oct 22, 2024 · 7 comments
Labels
bug Something isn't working cli Related to the command line interface

Comments

@JoacoAnselmo
Copy link

JoacoAnselmo commented Oct 22, 2024

Terms

Describe the issue

Hi! I installed manim slides, everything went well, but whenever I try to render my scene it gives an error message (although it does render, so manim is working).

Then, if I try to run manim-slides, it tells me the JSON doesn't exist.

I haven't found anything on the other issues about this. Any help would be appreciated!

(I inserted the corresponding code and error messages below, I'm hoping it shows up on the issue report, it is my first time submitting one).

Command

manim -pqh scene.py EjemploSlides

Issue Type

Other

Python version

Python 3.11.3

Python environment

Manim Slides version: 5.1.9
Python executable: C:\Users\Joaquín\AppData\Local\Programs\Python\Python311\python.exe
Manim bindings:
"sox" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
SoX could not be found!

    If you do not have SoX, proceed here:
     - - - http://sox.sourceforge.net/ - - -

    If you do (or think that you should) have SoX, double-check your
    path variables.

        manim (version: 0.18.1)
        manimgl not found
No Qt API found, some Manim Slides commands will not be available

What is your platform?

Windows

Other platform

No response

Manim Slides Python code

class EjemploSlides(Slide):
    def construct(self):
        punto = Dot(ORIGIN, color=BLUE)
        self.play(Create(punto))
        self.next_slide()

        self.play(punto.animate.shift(RIGHT))
        self.next_slide()

        self.play(FadeOut(punto))

Relevant log output

C:\Users\Joaquín\AppData\Local\Programs\Python\Python311\Lib\site-packages\manim\cli\render\comm │
│ ands.py:120 in render                                                                            │
│                                                                                                  │
│   117 │   │   │   try:                                                                           │
│   118 │   │   │   │   with tempconfig({}):                                                       │
│   119 │   │   │   │   │   scene = SceneClass()                                                   │
│ ❱ 120 │   │   │   │   │   scene.render()                                                         │
│   121 │   │   │   except Exception:                                                              │
│   122 │   │   │   │   error_console.print_exception()                                            │
│   123 │   │   │   │   sys.exit(1)                                                                │
│                                                                                                  │
│ C:\Users\Joaquín\AppData\Local\Programs\Python\Python311\Lib\site-packages\manim_slides\slide\ma │
│ nim.py:136 in render                                                                             │
│                                                                                                  │
│   133 │   │                                                                                      │
│   134 │   │   config["max_files_cached"] = max_files_cached                                      │
│   135 │   │                                                                                      │
│ ❱ 136 │   │   self._save_slides(                                                                 │
│   137 │   │   │   use_cache=not (config["disable_caching"] or self.disable_caching),             │
│   138 │   │   │   flush_cache=(config["flush_cache"] or self.flush_cache),                       │
│   139 │   │   │   skip_reversing=self.skip_reversing,                                            │
│                                                                                                  │
│ C:\Users\Joaquín\AppData\Local\Programs\Python\Python311\Lib\site-packages\manim_slides\slide\ba │
│ se.py:532 in _save_slides                                                                        │
│                                                                                                  │
│   529 │   │   │                                                                                  │
│   530 │   │   │   # We only concat animations if it was not present                              │
│   531 │   │   │   if not use_cache or not dst_file.exists():                                     │
│ ❱ 532 │   │   │   │   concatenate_video_files(slide_files, dst_file)                             │
│   533 │   │   │                                                                                  │
│   534 │   │   │   # We only reverse video if it was not present                                  │
│   535 │   │   │   if not use_cache or not rev_file.exists():                                     │
│                                                                                                  │
│ C:\Users\Joaquín\AppData\Local\Programs\Python\Python311\Lib\site-packages\manim_slides\utils.py │
│ :34 in concatenate_video_files                                                                   │
│                                                                                                  │
│    31 │   │   tmp_file = f.name                                                                  │
│    32 │                                                                                          │
│    33 │   with (                                                                                 │
│ ❱  34 │   │   av.open(tmp_file, format="concat", options={"safe": "0"}) as input_container,      │
│    35 │   │   av.open(str(dest), mode="w") as output_container,                                  │
│    36 │   ):                                                                                     │
│    37 │   │   input_video_stream = input_container.streams.video[0]                              │
│                                                                                                  │
│ in av.container.core.open:420                                                                    │
│                                                                                                  │
│ in av.container.core.Container.__cinit__:266                                                     │
│                                                                                                  │
│ in av.container.core.Container.err_check:286                                                     │
│                                                                                                  │
│ in av.error.err_check:326                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: [Errno 22] Invalid argument: 'C:\\Users\\JOAQUN~1\\AppData\\Local\\Temp\\tmp519hqu_y.txt'

# And then I get
Usage: manim-slides present [OPTIONS] [SCENES]...

Error: File slides\EjemploSlides.json does not exist, check the scene name and make sure to use Slide as your scene base class

Screenshots

No response

Additional information

This is the first time I'm using it, so there may be an installation bug or something like that

Recommended fix or suggestions

No response

@JoacoAnselmo JoacoAnselmo added the bug Something isn't working label Oct 22, 2024
@jeertmans
Copy link
Owner

jeertmans commented Oct 22, 2024

Hello @JoacoAnselmo, thanks for reporting your bug!

Can you provide the command that you run for rendering the animations?
Nevermind, you did provide it :-)

Can you try running

manim-slides render -pqh scene.py EjemploSlides

instead?

As indicated by the last line in your error traceback, the JSON file does not exist, which indicates that the rendering failed.

@jeertmans jeertmans added the cli Related to the command line interface label Oct 22, 2024
@jeertmans jeertmans changed the title [BUG] <Error 22 - Invalid argument> [BUG] ValueError: [Errno 22] Invalid argument Oct 22, 2024
@JoacoAnselmo
Copy link
Author

Hi, thanks for answering! After running that coide, I get this output:
`Usage: manim-slides render [-h] [--CE|--GL] [RENDERER_ARGS]...

Render SCENE(s) from the input FILE, using the specified renderer.

Use manim-slides render --help to see help information for a specific
renderer.

Options:
--CE If set, use Manim Community Edition (CE) renderer. If this or --GL
is not set, defaults to CE renderer. [env var: MANIM_RENDERER]
--GL If set, use ManimGL renderer. [env var: MANIMGL_RENDERER]
-h Show this message and exit.`

It's as if it didn't really run at all, I think.

A couple things that may be of interest: At first I installed manim_presentation, but after some quality issues I decided to try this instead, so maybe there's some clash there. One other thing, I've noticed that the import doesn't get properly colored in VSCode, maybe it's just visual but I thought it was worth mentioning. The "Slide" stays not colored.

image

@jeertmans
Copy link
Owner

My bad, this is because -pqh is understood as -p -q -h by manim-slides, and -h triggers the help menu. A possible workaround is:

manim-slides render -p --quality=h scene.py EjemploSlides

For your example, I can't say much unless you include a full code that I can run locally :-)

@JoacoAnselmo
Copy link
Author

Same output :(
Could it be that it isn't interpreting the file address correctly for some reason? The .txt at the address that is an "invalid argument" does exist, and it itself contains an address to a partial movie file that again, does exist.

@jeertmans
Copy link
Owner

Which error message, the first one of the second one?

@JoacoAnselmo
Copy link
Author

Sorry, the first one.

@jeertmans
Copy link
Owner

I think the error comes from Manim, not Manim Slides, but maybe I am wrong. Can you try rendering the animations without Manim Slides (so with Scene as a base class)?

If possible, use the same Python environnement, and put the output here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the command line interface
Projects
None yet
Development

No branches or pull requests

2 participants