mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Revert to -e to create a new temporary file, rather than writing over the original
This commit is contained in:
parent
205116b8ce
commit
efe051b8e1
1 changed files with 4 additions and 4 deletions
|
@ -245,13 +245,13 @@ def insert_embed_line(file_name: str, scene_name: str, line_marker: str):
|
|||
n_spaces = get_indent(lines[prev_line_num])
|
||||
new_lines = list(lines)
|
||||
new_lines.insert(prev_line_num + 1, " " * n_spaces + "self.embed()\n")
|
||||
with open(file_name, 'w') as fp:
|
||||
alt_file = file_name.replace(".py", "_insert_embed.py")
|
||||
with open(alt_file, 'w') as fp:
|
||||
fp.writelines(new_lines)
|
||||
try:
|
||||
yield file_name
|
||||
yield alt_file
|
||||
finally:
|
||||
with open(file_name, 'w') as fp:
|
||||
fp.writelines(lines)
|
||||
os.remove(alt_file)
|
||||
|
||||
|
||||
def get_custom_config():
|
||||
|
|
Loading…
Add table
Reference in a new issue