omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. KipCarter
    3. Posts

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 13
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by KipCarter

    • RE: Wish list for post 3.3...

      @ccc , Thanks, would be nice if it were updated to handle 3x code.

      posted in Pythonista
      KipCarter
      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.

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Getting 'set' to print

      @pulbrich ,
      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.

      THANKS!

      posted in Pythonista
      KipCarter
      KipCarter
    • 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.

      posted in Pythonista
      KipCarter
      KipCarter
    • 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.

      Thanks!

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Interpreter over command line

      I got this response below which was extremely helpful...

      bennr01 posted 3 days ago 0
      @KipCarter said:

      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>.

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Can't pip install subprocess

      @bennr01 That did it! Thanks

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Can't pip install subprocess

      thanks... will get it installed!

      posted in Pythonista
      KipCarter
      KipCarter
    • 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.

      Thanks folks!

      I still want to know the pip procedure as what I've found documented doesn't seem to work.

      Kip...

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Can't pip install subprocess

      So what is the proper procedure for pip'ing in new modules?

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Can't pip install subprocess

      My apologies....

      I should have noted when posting the above code that the subprocess issue is first noted when executing line 8.

      theargis +=str(sys.argv[1])
      

      Regards!

      posted in Pythonista
      KipCarter
      KipCarter
    • RE: Can't pip install subprocess

      That is a bit disheartening.... I have used the following on windows with Python 3.6 and was hoping to convert it to Phthonista so I could run it from an iPhone or iPad. But it sounds like I need to look for a different solution.

      import os
      import sys
      import subprocess
      from socket import *
      subprocess.call("cls", shell=True)
      theargis = ''
      if len(sys.argv) > 1:
          theargis +=str(sys.argv[1])
      if theargis > '':
          host = theargis
          print ("Using Server Address of " + theargis + ":")
      else:
          host = "53.68.241.25" 
          print ("Using Default Address of " + host + ":")
      port = 13000
      addr = (host, port)
      UDPSock = socket(AF_INET, SOCK_DGRAM)
      while True:
          data = input("Enter message to send or type 'EXIT': ")
          bytes = data.encode()
          UDPSock.sendto(bytes, addr)
          if data.upper() == "EXIT":
              break
      UDPSock.close()
      os._exit(0)```
      
      What I am working out in the larger schema, is to collect bar-code scans and with each collection return the data back to a desktop PC to be processed and distributed as a periodic data feed.  This would be the last component in that process.
      
      Being new to Python code, adapting around the calls to the subprocess module will make this challenging to say the least.
      
      I appreciate the feedback.
      Kip...
      posted in Pythonista
      KipCarter
      KipCarter
    • Can't pip install subprocess

      I am attempting to install my first module with Pythonista and running into an error that I'm guessing is the result of my improper use of pip.

      I'm attempting this from inside the console for 3.6.

      I've tried:

      • python -m pip install subprocess
        (invalid syntax on pip)

      • python pip install subprocess
        (invalid syntax on pip)

      • pip install subprocess
        (invalid syntax on install)

      I've read over the information at http://omz-software.com/pythonista/docs/installing/index.html , but I still must be missing something.

      Thanks!

      posted in Pythonista
      KipCarter
      KipCarter