Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Python Koans don't recognize modified files without a restart
-
I just bought pythonista today as a way to learn python in my spare time.
I got the python koans project copied over to pythonista via Dropbox, and was happy to see that the project works nicely.
I had to modify the script a bit to make it not use the colorama ANSI codes since the console doesn't recognize them but that is a minor issue.
Somewhat more annoying is that running the contemplate.py script does not recognize modified files unless I exit out of pythonista, force it closed, and restart.
I tried adding a compile all invocation to the contemplate script. That did compile the koans into pyc files, but it seems like pythonista still used the old version of the koans.
Is there a way to force pythonista to use the latest versions of the files without have to completely restart?
Thanks!
-
How about running editor.reload_files() after your files have been modified?
-
I tried adding a call to reload files in the comtemplate script, but unfortunately that had no effect.
'''
You have not yet reached enlightenment ...
AssertionError: '-=> FILL ME IN! <=-' != 'TypeError'Please meditate on the following code:
File "./koans/about_methods.py", line 27, in test_calling_functions_with_wrong_number_of_arguments
self.assertEqual(TypeError, exception.class.name)
'''Based in the error message, it seems like pythonista is not recompiling the modified module, but it does know the file has been modified. The first line of the error shows the value from the "blank" variable while the second shows what is actually in the file.
This is why I thought compileall() might help, but that created pyc files that pythonista does not seem to use. Is there a pythonista module with a method that tells it to refresh its internal compilation cache?
-
I use reload() in my scripts to reload dependent and potentially updated modules. It works fine for me.
This is not the same as editor.reload_files().