- How to execute a python file on Ti-Nspire without importing
10 Sep 2020 04:00:00 am - 10 Sep 2020 08:01:18 pm
- Last edited by WhiteShadow on 10 Sep 2020 11:30:49 pm; edited 1 time in total
Right now, I need to import my python file to the python shell in order to run it. However, it's really not ideal for me to reinitialize the shell every time I want to execute something, and I don't want the user to be messing with my code. I did exec(open('file.py').read()) but it raised an error, ValueError: Unsupported use of open. Are there any alternatives? Ideally, I want to create a program called 'programrunner' and have a function called run() to run specified program.
For example:
Code:
Any help or suggestion will be appreciated
For example:
Code:
>>> from programrunner import run
>>> run('epicfile.py')
Any help or suggestion will be appreciated