Python scripts can be edited in VIM and run in a shell in a-shell app, if that is what you are looking for.
Also has GitHub access via lg2.
Pip for installing packages.
Pico for quick edits.
Also, free.
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 FarmerPaco
-
RE: Alternative to Pythonista
-
RE: Creating functions that work with my scene class
@resserone13 This was helpful. Was having difficulty with creating delays and this cleared it up. Thanks for the pointer. Cheers.
-
RE: Has somebody already used PyDrive to access Google Drive files?
This is a repeat of a follow-up in a different thread but since it address the matter of access and manipulation of Google Drive files I am going to cross-post it here:
Just to follow up on this matter. After struggling with PyDrive in pythonista for a while with resulting errors, I opted to just go ahead and try the Google Drive API.
There is a super simple tutorial in codelabs:
https://codelabs.developers.google.com/codelabs/gsuite-apis-intro/#0Everything installs nicely and runs well. It even lets you complete the authentication in a separate browser if need be. I did the authentication on my raspberry pi and scped the secrets.jason and since then it works perfectly.
Just in case anyone wants to access and G suite files, you should know that pip in stash running in python3 nicely installs google-api-python-client and oauth2client in the site-packages-3 (which is all you need for Google Drive API).
-
RE: Installing the scp module via pip (in stash)
Just to follow up on this matter. After struggling with PyDrive in pythonista for a while with resulting errors, I often to just go ahead and try the Google Drive API.
There is a super simple tutorial in codelabs:
https://codelabs.developers.google.com/codelabs/gsuite-apis-intro/#0Everything installs nicely and runs well.It even lets you complete the authentication in a separate browser if need be. I did the authentication on my raspberry pi and scped the secrets.jason and since then it works perfectly.
Just in case anyone wants to access and G suite files, you should know that pip in stash running in python3 nicely installs google-api-python-client and oauth2client in the site-packages-3 (which is all you need for Google Drive API).
-
RE: Installing the scp module via pip (in stash)
@bennr01 just want to confirm that installing PyDrive via pip on raspbian downloads pyasn1 0.4.5
This is not the same with pip in stash 7.1.
But I honestly don’t know how much it matters.
-
RE: Installing the scp module via pip (in stash)
@bennr01 I am not running 7.2. Running 7.1 and that might be part of my problem. Will update shortly.
Regarding pyasn1, versions 2.1 to 4.2 were released in 2017.
I believe I am looking at the version of pyasn1 correctly. I only did so because in the original guide I was following @JonB specifically installed a version of pyasn1 after PyDrive. I wanted to make sure my version was the same or higher.
I looked in: /site-packages-2/pyasn1/init.py
version = '0.2.1'
Then I looked in: /site-packages-3/pyasn1/init.py
version = '0.1.7'
Not sure why these would be different, or why the version in my python3 would be an earlier version. I am thinking to delete these packages from PyDrive and dependencies, update stash and then reinstall with pip.
Also plan to do a PyDrive on my raspberry pi today and compare the files.
I am still new to this stuff but what to understand better what’s happening under the hood. -
RE: Installing the scp module via pip (in stash)
@JonB Thanks again for your time
I’m going to install PyDrive on my Pi zero to familiarize myself with the normal process so I can debug where along the process my pythonista install is failing.I did check the site packages and saw the Stash running 2.7 installs a more updated version of pyasn1 (v. 2.1) where as stash runing at 3.6 installs an earlier version of pyasn1 (v.1.7). This seemed strange.
Thanks again for your feedback. I will finish a PyDrive install on Rasbian (debian) which should be straightforward and then see where I am going wrong on Pythonista.
I will also check stash/bin/scp.py -
RE: Installing the scp module via pip (in stash)
@JonB thanks for pointing out my options. Will probably try installing the ssh python module first.
Normally when I think of ssh I think of Bash, and since Stash (from what I read) is really just emulating a shell, I wasn’t sure if that would get in the way.
I guess there is only one way to find out.
Again, thanks. -
RE: Installing the scp module via pip (in stash)
@mikael thanks for this. I will check it out later, but it looks like something I should know.
I am assuming that in s.connect the port is 22 for sftp.
Thanks for the pointer. -
RE: Installing the scp module via pip (in stash)
@JonB Yes, it is. I use scp in stash, but was hoping to be able to call scp from inside a python3 script.
Something like this:from paramiko import SSHClient from scp import SCPClient ssh = SSHClient() ssh.load_system_host_keys() ssh.connect('example.com') with SCPClient(ssh.get_transport()) as scp: scp.put('test.txt', 'test2.txt') scp.get('test2.txt')
I know there is an scp python module:
python scp moduleCan I call a Stash command from a python3 file to run scp from stash?
Sorry if I am not making sense.
Thank you again, since I feel like I keep asking you questions. -
RE: Has somebody already used PyDrive to access Google Drive files?
@JonB thanks again for coming to the rescue (I remember you helped me with turtle2).
Let me indicate what I did:
1.installed PyDrive with Stash running in 2.7 which installed to Site packages 2. I realized this when I tried to run the following code in python 3.6
from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive import webbrowser # Create local webserver and auto handles authentication. # Standard webbrowser gave an error, JonB found the solution if not hasattr(webbrowser,'_open'): webbrowser._open=webbrowser.open def wbopen(url, *args,**kwargs): return webbrowser._open(url) webbrowser.open=wbopen gauth = GoogleAuth() gauth.LocalWebserverAuth() # upload drive = GoogleDrive(gauth) file1 = drive.CreateFile({'title': 'Hello.txt'}) # Create GoogleDriveFile instance with title 'Hello.txt'. file1.SetContentString('Hello World!') # Set content of the file from given string. file1.Upload() file1 = drive.CreateFile({'title': 'pyconnect.py'}) # Create GoogleDriveFile instance with title ... file1.SetContentFile('pyconnect.py') # Set content of the file from given file file1.Upload()
and received an import error.
- Installed PyDrive again in stash running python 3.6. Now I have the PyDrive module in both site packages.
Tried to run code and received an error in line 202 of the discovery.py dependency.
I need to admit that I have not done a pip install of pyasn1 because the printout on the PyDrive install stated that the dependency was already there.I appreciate your help.
Since I have PyDrive installed in both site packages. My questions are:1.Do I still need to reinstall pyasn1 like you did originally?
-
@cvp is running PyDrive in python3. Can PyDrive by installed using stash running 3.6? I plan to use PyDrive in python3 exclusively. I use this for education. (Full disclosure: I am a lousy teacher and an even worse student).
-
Why would I get a syntax error in discovery.py (which I am not even sure what it is.) Can I reinstall this modul again without errors from pip install?
@shinyformica thanks for the offer for help. I will probably take you on it was I reach the authentication stage. I have already complete my google console step, downloaded the unknown file, remained and move to my current directory.
Thank you everyone for taking time from your surely busy schedules to help me.
Thank yo in advance for any further guidance.
I want to install PyDrive on pythonista on my students so they can automate checking their work.Best,
Justin -
RE: Has somebody already used PyDrive to access Google Drive files?
Hi @JonB and @cvp
Just completed this install.Run with python3
Returns syntax error on line 202 of discovery.pyTraceback reads:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/BDD90EB4-7B3E-4A50-A939-642531B58BFE/Pythonista3/Documents/pyconnect.py", line 1, in <module>
from pydrive.auth import GoogleAuth
File "/private/var/mobile/Containers/Shared/AppGroup/BDD90EB4-7B3E-4A50-A939-642531B58BFE/Pythonista3/Documents/site-packages-3/pydrive/auth.py", line 7, in <module>
from apiclient.discovery import build
File "/private/var/mobile/Containers/Shared/AppGroup/BDD90EB4-7B3E-4A50-A939-642531B58BFE/Pythonista3/Documents/site-packages-3/apiclient/discovery.py", line 202
except ValueError, e:
^
SyntaxError: invalid syntaxDoes PyDrive still work with pythonista?
(With python2.7 I also get a name error: cannot import name util )
Any pointers or help would be much appreciated.
Thanks in advance -
Installing the scp module via pip (in stash)
Has anyone tried this yet?
I know paramiko is bundled in.
Has anyone successfully install scp? -
RE: Text input in a <Scene> based Game
Here is a sample of using ui.textfield for input in scene
-
RE: Text input in a <Scene> based Game
I might be late to this conversation but I am using Scene to build a visual Zork, and I find that ui.textfield works perfect for input.
def player_input(self): def command_given(sender): self.command = com_input.text self.player_command() com_input = ui.TextField() com_input.name = 'What next?' com_input.autocapitalization_type = False com_input.background_color = 'lightblue' com_input.frame = (0, 0, 500, 50) com_input.present('popover', popover_location = (5, 685)) com_input.clear_button_mode = 'always' com_input.action = command_given def player_command(self): if self.command in ['north', 'south', 'east', 'west']: self.current_room = self.current_room.move(self.command) self.player_roominfo() ```
-
RE: Launchers
This looks really interesting. Would love to try it. Is there a package on github to download?
-
RE: Method to upload Pythonista code to Raspberry Pi?
I use github to move projects from pythonista to and from my raspberry pi.
It is easiest to simple install stash and then git push or pull from pythonista. Alternatively you can scp from stash and move files directly to or from the raspberry pi.When managing the pi I use the Termius app to ssh and manage files via bash, but you can also ssh directly from stash.
It would seem that stash is what you need. Plus using git allows for version control between pythonista and your pi.
Please know that I am no expert, but I hope this helps.
FYI: Stash is on GitHub with an easy one line installer.
-
RE: shape() method for turtle.py
@JonB this works beautifully. I now have little turtles all over my screen. You should share this with @olemoritz incase he feels like adding it to the turtle module in Pythonista.
Seriously, thank you. -
RE: shape() method for turtle.py
Thanks for a quick reply. Let me take a look at this. I am really grateful.
-
shape() method for turtle.py
Love that @olemoritz quietly added a turtle.py module.
Unfortunately turtle.shape() is still on the todo list.
If someone with more skill then me can help me turn the current triangle shape into a little turtle shape it would be magic to my students who are learning python3 on pythonista.
I am guessing the curent turtle shape is drawin in the
pen_tip = ui.path
Would it be as simple as painstakingly drawing a ui.path outline of a turtle shape to change the default triangle?