Forum Archive

Pythonista bug

donnieh

I am deep into a pythonista project saved in the iCloud folder. The code was a few hundred lines long so I went to the gear icon to reduce the editor font size. I changed it from 12 to 10 to see more code on my iPhone.

Then went I went back to the main file and the editor updated the code to the new font size by flashing the screen, but I noticed it also overwritten my code with old code from 2 days ago. A lock icon showed up at the top but doesn't anymore.

1) Why would changing the font size erase my latest changes from the last 2 days?
2) Is there any back up in the app somewhere or some cache or something? I want to find this code it just erased.

I am very discouraged about this and feel like shelving my project because my best work and solutions were made over the last 48 hours.

donnieh

I am pretty sure my code is gone. If it can't be retrieved, at least this bug can be fixed so it doesn't happen again.

donnieh

Ok, I have some more information about this. It happened again last night, but it didn't require changing the font setting. I switched back and forth between my main.py file and the documentation tab. When I return back to the .py file it updated the editor text with code that was about 5 min old.

I immediately cut all my internet (airplane mode within 1 second) so no further iCloud syncing could happen. My internet was on 3G so syncing was slow-ish.

I then download Pythonista to another iOS device and allowed iCloud to sync the files it had. Wouldn't you know!? The iCloud version was the 5 minute old file!

I am wondering if the Pythonista editor refreshes the current editor text with the iCloud version .py file even if it is older or not fully synced. I am not sure if my assumption is truly correct, but I wanted to share this issue. Maybe it is something I am doing wrong.... I believe this issue is isolated to the iCloud folder. I never seen this until I moved my project to from the phone folder to the iCloud folder.

For now, I just added the following code to my project so it archives everytime I run.

```

Back up script to text file before running

import editor
import datetime
st = editor.get_text() # script text
dt = str(datetime.datetime.now())
f = open('Backup '+ dt, "w+")
f.write(st)
f.close()

my script below...

​```