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!
-
-
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...
-
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!
-
@KipCarter Yes,
subprocess.call("cls")
will not work with pythonista for multiple reasons:cls
is a windows command. Even if you could usesubprocess
, you would have to usesubprocess.call("clear")
instead.- the pythonista shell is not a real shell, but a simple python REPL and I/O shell, so neither
cls
norclear
would have any effect on it.
You can instead use
console.clear()
in pythonista.
-
So what is the proper procedure for pip'ing in new modules?
-
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...
-
@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 calledlaunch_stash.py
in themy 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 supportspip install <modulename>
.
-
thanks... will get it installed!
-
@bennr01 That did it! Thanks
-
This post is deleted!last edited by river888a