Forum Archive

Help - I corrupted my Pythonista somehow

Phuket2

I am not sure how I have managed to do this. But I have corrupted my Pythonista v311008. If I import json I get the below traceback. I only get the traceback after I restart, because if I tap the print traceback the app quits. The corruption seems to be limited to importing json. I had been playing with shelve when the Corruption started ( I was using faker and adding a lot of records into shelve).
Not sure if there is an easy way to fix this. I don't want to delete the app. My thoughts are that I download the App Store version, then install the test flight version after. Just wanted to ask first, so I don't screw it up.

--edit if I run with 2.7, I don't get the problem. Also I should mention I did a full restart of my ipad

Traceback (most recent call last):
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pykit_startup.py", line 51, in
main()
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pykit_startup.py", line 47, in main
import importcompletion
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/importcompletion.py", line 26, in
import imp
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/imp.py", line 28, in
import tokenize
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/tokenize.py", line 34, in
import re
File "/var/containers/Bundle/Application/EA1EEECB-E4B2-4C5F-ACE0-B7287FEACF04/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/re.py", line 143, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

ccc

in Safari, go to the following URLs:
* pythonista://
* pythonista2://
* pythonista3://

Phuket2

@ccc , sorry I was not clear. I am not locked out of Pythonista, but I have corrupted the json lib by the looks of things. I can use it anymore. Just importing it creates the error

Phuket2

Possibly using stash to update it may work, but i was unsure. Might make things worse

ccc

Did you quit Pythonista and try my suggestions anyway?

Phuket2

@ccc , yes i did. The first 2 cmds load Pythonista 2 app which i still have. But i did try it in case there was some magic I didn't know about. I also disabled my startup script.

dgelessus

@Phuket2 Do you have an enum.py module or enum folder in your site-packages or site-packages-3? enum.IntFlag (the class that's missing and causing the exception) is new in Python 3.6, so if you manually installed a different version of the enum module previously, you need to delete it or update it.

Phuket2

@dgelessus , i have a enum folder in my site-packages folder. Should I just delete it? I didn't Install it directly, maybe a package i installed, installed it

ccc

Rename enum in your site-packages to was-enum and completely reboot.

Phuket2

@ccc , thanks , that fixed it. Not sure how that enum dir got in there. I was using shelve and json. But fixed now, and it inspired me to do a full backup :)