question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scene-Caching w/ "-" as filename bug : Cannot use Updaters.

See original GitHub issue

Consider the following test script:

class Test(Scene):
        def construct(self):
                v = ValueTracker(10)
                a = Integer().add_updater(lambda m:m.set_value(v.get_value()))
                self.add(a)
                self.play(v.set_value,100)

Rendering this by saving it as a file, then rendering it will work. However, if you render the same test script by inputting it directly into STDIN, which you can do by providing - as the filename, then the render will fail with the following traceback:

Traceback (most recent call last):
  File "/Users/aathishs/Python/ManimEnv/manim/manim/__main__.py", line 168, in main
    scene = SceneClass()
  File "/Users/aathishs/Python/ManimEnv/manim/manim/scene/scene.py", line 77, in __init__
    self.construct()
  File "<string>", line 7, in construct
  File "/Users/aathishs/Python/ManimEnv/manim/manim/scene/scene.py", line 802, in wrapper
    hash_play = get_hash_from_play_call(
  File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 146, in get_hash_from_play_call
    current_mobjects_list_json = [
  File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 147, in <listcomp>
    get_json(x) for x in sorted(current_mobjects_list, key=lambda obj: str(obj))
  File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 98, in get_json
    return json.dumps(obj, cls=CustomEncoder)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 82, in encode
    return super().encode(self._encode_dict(obj))
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 40, in default
    return {"code": inspect.getsource(obj), "nonlocals": cvardict}
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 985, in getsource
    lines, lnum = getsourcelines(object)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 967, in getsourcelines
    lines, lnum = findsource(object)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 798, in findsource
    raise OSError('could not get source code')
OSError: could not get source code

cc @huguesdevimeux

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
huguesdevimeuxcommented, Aug 26, 2020

Thanks for the report.

I will add this the stack of 456 things I have to fix of the scene caching.

0reactions
leotrscommented, Sep 3, 2020

Ok so let’s just document somewhere. I think there should be a whole documentation page on CLI arguments…

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws_lambda_function does not use partial state and ... - GitHub
aws_lambda_function does not use partial state and will update the "filename" property even when it can't be read. #25886.
Read more >
Virus scan bug when file has multiple periods in filename can ...
Latest update appears to have caused Defender to crash whenever scanning a file with multiple period characters in them.
Read more >
Common problems and solutions—Portal for ArcGIS (10.4.1)
This topic lists questions or issues that you might encounter when working with Portal for ArcGIS and suggests possible solutions. If you don't...
Read more >
How to fix "A filename can't contain any of the ... - YouTube
Make sure you copy only the text and not the "Enter" or "new line" character at the end of the line also!
Read more >
How To Fix File not Found Check the File Name and Try Again ...
Transcript · 11 New Features in Windows 11 22h2 // Tips and Tricks for the 2022 Update · 7 Ways to Fix a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found