I'm making a basic editing software.
A simplified version of parts of the code are below (and they still produce the same result as with the actual program):
File named mod.py
:
from mod2 import toptext
cmdtext = "Edit video: tt=test,"
presentCommands = ['tt=']
def initCommands(presentCommands, cmdtext):
vidfilter = []
if 'tt=' in presentCommands and 'bt=' not in presentCommands:
vidfilter = toptext(cmdtext, vidfilter)
print("Top text vidfilter is", vidfilter)
else:
print('no')
initCommands(presentCommands, cmdtext)
File named mod2.py
:
import re
def toptext(cmdtext, vidfilter):
vidfilter = vidfilter
texts = (re.findall(r'tt=(.*?),', cmdtext))
text = texts[0]
print(text)
vidfilter = vidfilter.append("subtitles=/example/file/path/toptext.srt:force_style='Fontname=Impact,Fontsize=30,Alignment=6'")
print("The vidfilter is:", vidfilter)
return vidfilter
The output of running mod.py
is this:
test
The vidfilter is: None
Top text vidfilter is None
As you can see, vidfilter is printed as None
, when I want it to be ["subtitles=/example/file/path/toptext.srt:force_style='Fontname=Impact,Fontsize=30,Alignment=6'"]
instead. Is append()
not working or something?
Can anyone please help me fix this and let me know why it's happening? Please note I'd like to keep mod.py
and mod2.py
as separate files.