@ccc , Thanks, would be nice if it were updated to handle 3x code.
Latest posts made by KipCarter
RE: Wish list for post 3.3...
I'm pretty new to using Pythonista, so this may be possible and I just haven't discovered the key to it:
- Compiler to export my scripts to a stand alone iOS app. (big wish, but a wish none the less).
I'm using Pythonista to automate processes so the code I build for iOS will typically be used by someone in their work. Getting to a single icon to start the apps would be a huge boon.
RE: Getting 'set' to print
Thanks, and I should have picked up on that even with my limited experience in Python, since all I've been working in is 3x Python.
This DID cause the code to print the set after "All scanned codes:' , but then as usual popped another 'No method found for stringValue' error with it. That likely is an issue nested in P2x v P3x code as this was.
For what I want to use this code for, it really doesn't matter at all, because what i want to do is build a function and nest it in the seeding of the found_codes to send off the data to a database, so this was more a frustration/curiosity that I really wanted to see resolved for my own benefit more than the project I'm working on.
RE: Problem pasting a string
Have you attempted to paste the string from the source into a simple text editor and then copy it back out again to be pasted into Pythonista? I've run into several instances across various platforms and apps where data has hidden data that another app will reject out of hand. I've not seen a situation where striping the data with some other tool was not effective in getting it to paste properly.
One caveat to this is if you're attempting to paste several lines into your python code, often must be accomplished a line at a time. So if the 'string' you are referring to has multiple lines, that is another game entirely.
Hope this helps.
Getting 'set' to print
I've found a great little piece of code to scan bar codes from an iOS device. If you would like to see the full code sample got to this link on the infragistics web page.
The code works really well, considering what the author basic premise is (scanning and interpreting bar codes). The only issue I am running into getting it to work perfectly on my iOS 13.3.1 iPhone and iPad, is when exiting the code the script directs a printout to the console of content of the variable 'found_codes'.
print ('All scanned codes:\n'), '\n'.join(found_codes)
This bit of code prints only the line 'All Scanned codes:' to the console.
I had modified this from the original code removing a + sign and inserting a comma (,)
print ('All scanned codes:\n') + '\n'.join(found_codes)
Pythonista protested with...
unsupported operand type(s) for +: 'NoneType'...
The code block that adds the bar code reading to 'found_codes is:
objects = ObjCInstance(_metadata_objects) for obj in objects: s = str(obj.stringValue()) if s not in found_codes: found_codes.add(s)
I'm puzzled by the fact that replacing the plus sign with a comma, clears the error message but after doing that, the print to the console doesn't take place.
I will stress I'm relatively new to python and pythonista, so I may be missing something obvious to the rest of you.
RE: Interpreter over command line
I got this response below which was extremely helpful...
bennr01 posted 3 days ago 0
So what is the proper procedure for pip'ing in new modules?
The community has written a custom implementation of pip, which is included in StaSh. It works rather well, but does not support any modules depending on C/Fortran code.
To install, copy the following: import requests as r; exec(r.get('https://bit.ly/get-stash').text), then paste it in the python REPL (the console) and exute it. Restart pythonista (force quit using double tap). Afterwards, there is a file called launch_stash.py in the my iphone (or whatever it is called) directory. Run it. It takes a bit of time, but you should then see a bash-like shell. This shell supports pip install <modulename>.
RE: Can't pip install subprocess
Going in a different direction now. I think I will resort to a simple smtp sender and receiver, placing my data in the subject header of each message and extracting it on the other side as it arrives on the pc. I need to setup a lab to make sure this will all work but it should.
I still want to know the pip procedure as what I've found documented doesn't seem to work.