Il codice è il seguente, una scritta che viene modificata e stampata secondo delle funzioni usando librerie grafiche:
from manim import *
from manim.opengl import *
config.renderer = "opengl"
class WhatIsFunction(Scene):
def construct(self):
hello_world = Tex("Hello World!").scale(3)
self.play(Write(hello_world))
self.interactive_embed()
L'errore è questo qui:
(venv) PS D:\JetBrains\PycharmProjects\swac_animation> manim -qm -p --renderer=opengl maths.py WhatIsFunction
Manim Community v0.17.3
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.14.0 -- An enhanced Interactive Python. Type '?' for help.
Loading history failed
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 37684 and this is thread id 52360.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 77, in catch_corrupt_db
return f(self, *a, **kw)
^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 660, in get_tail
self.writeout_cache()
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 60, in only_when_enabled
return f(self, *a, **kw)
^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 834, in writeout_cache
self._writeout_input_cache(conn)
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 815, in _writeout_input_cache
with conn:
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 37684 and this is thread id 52360.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\prompt_toolkit\buffer.py", line 422, in load_history_done
f.result()
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\prompt_toolkit\buffer.py", line 410, in load_history
async for item in self.history.load():
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\prompt_toolkit\history.py", line 59, in load
self._loaded_strings = list(self.load_history_strings())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\terminal\interactiveshell.py", line 175, in load_history_strings
for __, ___, cell in self.shell.history_manager.get_tail(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 104, in catch_corrupt_db
self.hist_file.rename(newpath)
File "C:\Users\fedel\AppData\Local\Programs\Python\Python311\Lib\pathlib.py", line 1175, in rename
os.rename(self, target)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\fedel\\.ipython\\profile_default\\history.sqlite' -> 'C:\\Users\\fedel\\.ipython\\profile_default\\history-corrupt-2023-06-20T20.29.05.994329.sqlite
'
Unhandled exception in event loop:
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\prompt_toolkit\buffer.py", line 410, in load_history
async for item in self.history.load():
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\prompt_toolkit\history.py", line 59, in load
self._loaded_strings = list(self.load_history_strings())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\terminal\interactiveshell.py", line 175, in load_history_strings
for __, ___, cell in self.shell.history_manager.get_tail(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\JetBrains\PycharmProjects\swac_animation\venv\Lib\site-packages\IPython\core\history.py", line 104, in catch_corrupt_db
self.hist_file.rename(newpath)
File "C:\Users\fedel\AppData\Local\Programs\Python\Python311\Lib\pathlib.py", line 1175, in rename
os.rename(self, target)
Exception [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\fedel\\.ipython\\profile_default\\history.sqlite' -> 'C:\\Users\\fedel\\.ipython\\profile_default\\history-corrupt-2023-06-20T20.29.05.994329.sqlite'
Press ENTER to continue...
Se vi è capitato un caso simile e avete questa versione Manim: v0.17.3 il problema sta nella versione di IPython:
pip install IPython==8.0.1
Aggiornando IPython con questa versione più vecchia va tutto senza bisogno di cambiare nulla.
Molto probabilmente questo è dovuto al fatto che la libreria Manim era compatibile solo per quella specifica versione di Python e non sono riusciti a stare al passo.
Per stare sempre aggiornati vi lascio la community GitHub qui!