Actually, the problem just got worse. I forgot that I have json files with 750 files in it that needs to be imported. It is very important that I be able to import these files because they speed up the program enormously.
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.
Posts made by bobsmith76
-
RE: Import several files at once
-
Import several files at once
Is there anyway to import several files at once. My program is split into 35 files and I have to import them one at a time. It is extremely tedious.
Also, I'm trying to open up a pickle that is 8 megs large. It takes a lot of time and it crashes before it opens. Is this normal? Of course, I can chop it up into 8 sections and put it back together, but I would rather not do that.
-
RE: can pythonista use pickles?
it automatically adds the .py extension to all files. so z_dict_words.pkl becomes z_dict_words.pkl.py. how do i rename files?
-
RE: can pythonista use pickles?
If I import a zipped pkl do I have to unzip it? If so how?
-
RE: can pythonista use pickles?
I was not able to rename the file but I created a new file and cut and paste the text of z_dict_words.py into the newly created z_dict_words.pkl. I then ran the code and pythonista was not able to load the pickle file. This is the error message I got:
File "/private/var/mobile/Containers/Shared/AppGroup/D4D2C25F-316F-47DF-8CFF-84E670A3283D/Pythonista3/Documents/main_loop.py", line 163, in get_result
dictionary = pickle.load(pkl_file)
_pickle.UnpicklingError: invalid load key, '\xc2'.These lines are 150 - 163 in my code:
def get_result(one_sent, user = "", print_type="40", order=[0], get_words_used=0): global words_used total_time = time.time() if one_sent == 'a': proof_type, print_type, get_words_used, order = parameters() pkl_file = open(user + 'zz_claims.pkl', 'rb') test_sent = pickle.load(pkl_file) pkl_file.close() elif one_sent != "": test_sent = one_sent else: pkl_file = open(user + 'zz_claims.pkl', 'rb') test_sent = pickle.load(pkl_file) pkl_file.close() pkl_file = open(user + 'z_dict_words.pkl', 'rb') dictionary = pickle.load(pkl_file) pkl_file.close()
I'm attaching a screenshot so as to demonstrate that the file is in my script library
-
RE: can pythonista use pickles?
i'm trying to download some kind of file manager app ut not having much success because i have an ipod 6 touch which is very old.
-
RE: can pythonista use pickles?
hold on, I didn't see that part about using the files app on the ipod.
-
RE: can pythonista use pickles?
here, I took some screenshots available here
https://drive.google.com/drive/folders/1djAgW_weu-eGZFB-ZKV_6ZOQzu6bxXrB?usp=sharing
when I click on the file to share on my desktop with is lemmata.pkl nothing relating to pythonista3 shows up.
-
RE: can pythonista use pickles?
Maybe I did this step incorrectly
https://forum.omz-software.com/topic/3606/script-to-import-any-file-in-pythonista-from-any-app
i named that files python_script and put it in my file folder which contains all of my other files. maybe that was wrong. in any case, when i click on pyth_script.py from 'script library' this ipod touch, i then hit the wrench sign, then share, then run pythonista3, then i see that menu you're telling me about. when i hit edit script, nothing happens, because just take me back to the script library and the pkl files aren't there, when i hit import file, it just copies the pyth_script to my script library.
-
RE: can pythonista use pickles?
Ok, I can do the first 3 steps but when I go and hit edit script, a list of my files will pop up which are available in my icloud and even though my pkl files are in my icloud they do not appear so that I cannot select them. I tried renaming them as dat files but that did not work either.
-
RE: can pythonista use pickles?
right now the file is in the same folder is in the same folder that I put my other files when i want to import: my icloud folder. i put all my files into the icloud then i hit 'this ipod' and then hit the plus sign to import the files but the pkl files are grayed out.
-
RE: can pythonista use pickles?
I don't see how you import via share. The only place I know to import is to click on 'this ipod touch', that gives me the choice to hit a + sign but I do not see a button that says 'share'. I then tried clicking on the setting and i did see 'share extension shortcuts'. I then hit run script but nothing happened.
-
RE: can pythonista use pickles?
ok I changed the code to
resp = console.alert('Alert!', 'Choose File Extension', '.py', '.pyui', '.pkl', hide_cancel_button=False) if resp == 1: ext = '.py' elif resp == 2: ext = '.pyui' elif resp == 3: ext = '.pkl'``` Then I ran the code and clicked pkl and it said Done! saved in ~Documents/inbox as clipboard 1.pkl. I then went back and tried to import the pickle files but they were still grayed out.
-
RE: can pythonista use pickles?
yea, I meant pickle. Right now, I can't import pkl files into pythonista. How do I do it?
-
can pythonista use pickles?
My python program relies heavily on pickles. Without pickles the thing will never work. Further, it would take an enormous amount of time to rebuild my program without pickles and I'm not willing to do that since I essentially use pythonista just to show off at parties or social events. Is there anyway to get these pickles to work or is there some type of work around?
-
RE: I cannot import modules
Also, I want to add that pythonista is a real big boost for me. You can't just whip out your laptop at a party and say 'hey, look I can calculate the consistency of sentences' but you can do that if you have an iphone.
-
RE: I cannot import modules
got it working. The problem was that there were four possibilities and I was only trying 3 of them.
- dots before file name in the external library
- no dots before file name in the external library
- dots before file name in the script library
- no dots before file name in the script library
The fourth possibility was the one that worked. I want to thank you for sticking with me through this trying ordeal.