I've seen this issue around, where when specifying a custom file the user gets back a syntax error. Tested and verified that the problem is that exec is being called on the filename instead of the file contents. The exec function is meant to execute a string of Python code, not to execute the file by its path. The exec command typically works like:
# Define the path to the file
file_path = 'YOURPATH'
# Read the content of the file
with open(file_path, 'r') as file:
file_content = file.read()
# Execute the content of the file
exec(file_content)
but it's being called on self.codefile where self.codefile is the file path (and not the actual python code). This would cause a syntax error since exec expects python code and not the file path -- which is exactly what we're seeing.
I've seen this issue around, where when specifying a custom file the user gets back a syntax error. Tested and verified that the problem is that exec is being called on the filename instead of the file contents. The exec function is meant to execute a string of Python code, not to execute the file by its path. The exec command typically works like:
but it's being called on
self.codefile
whereself.codefile
is the file path (and not the actual python code). This would cause a syntax error since exec expects python code and not the file path -- which is exactly what we're seeing.This fix should resolve this. Thanks!