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.
Download script into Pythonista
-
you might try adding
import logging
logging.basicConfig(level=logging.DEBUG)before the lines that start the server. Then, check the console in pythonista to see if there are any errors logged server side.
-
If you have the workflow app, here's another solution for bringing in files that are open in other apps.
-
using third party client on mac will works. Some how using finder ftp will crash pythonista.
-
Is there an "idiot proof guide" ?
When I follow the GitHub link inside iphone's safari... is supposed that I must try to copy the code (with iphone built in option to copy text) and then paste inside pythonista?
If I do that, and try to run the code, it starts to show errors, like "()" after print, etc.
I have also tried another thread with workflow involved without luck.
Any help will be greatly appreciated.
Gus -
An easy way is to open the raw view of the code and then insert the url in this script. All the code is printed to the console and is easy to select.
import urllib2 url = 'https://raw.githubusercontent.com/humberry/PhoneManager/master/PhoneManager.py' print urllib2.urlopen(url).read()
if you use Pythonista3:
import urllib.request url = 'https://raw.githubusercontent.com/humberry/PhoneManager/master/PhoneManager.py' req = urllib.request.urlopen(url) print(req.read().decode('utf-8'))
-
@zzgus it's because you download a code for Python 2 and you run it in Python 3.
Either you convert the code to Python 3 (see tools button at top of script) or you force the code to run in Python 2 by inserting a first line #!python2 -
import requests url = 'https://raw.githubusercontent.com/humberry/PhoneManager/master/PhoneManager.py' print(requests.get(url).text)
Works in all versions of Pythonista.
-
Finally converted code from v2 to v3, thankyou @cvp for the trick. I see I have a new pyftpd.tar.gz file and a new folder:
pyftpdlib-1.4.0
-demo
-pyftpdlib
-pyftpdlib.egg-info
-test
CREDITS
LICENSE
make.bat
Makefile
MANIFEST.in
PKG-INFO
README.rst
setup.cfg
setup.oyWhere is the ftp server?
Thankyou
Gus -
Any help please?
I don't know what I'm doing wrong but unable to get the ftp running.Thankyou
Gus -
We'll need some more info to help you.
-
You just downloaded a module.
'Python FTP server library provides a high-level portable interface to easily write very efficient, scalable and asynchronous FTP servers with Python.'
Maybe you're looking for an ready-to-run FTP server? -
@zzgus Try going into the
pyftpdlib
directory and look for__main__.py
and see what running that does. If you want to provide command line arguments then press and hold the run button when you launch the script. There is no guarantee this will work but give it a try. -
@brumm said:
You just downloaded a module.
'Python FTP server library provides a high-level portable interface to easily write very efficient, scalable and asynchronous FTP servers with Python.'
Maybe you're looking for an ready-to-run FTP server?Yes is what I understood from @omz answer
There are various options, my current favorite is the script I've already linked to on Twitter: ā PythonistaFTP.py (GitHub) It basically starts an FTP server on your device that you can then connect to from a Mac/PC.
-
@ccc Basically when I run it gives this error:
ImportError: No module named 'pyftpdlib'.Thankyou
Gus -
Okay, after trying it I understand.
In Pythonista3 the module is downloaded in site-packages and not in site-packages2. After moving the directory you should insert!#python2
as first line in the PythonistaFTP code.
-
Sure I'm doing something wrong as it is my first incursion in programing.
I have made a simple program for my kids to practice the multiplication tables.
I don't want to re-type the code again in my iphone and ipad.I'm gona try to explain what I do:
For what I understood from @omz there's a script "PythonistaFTP.py" that starts an FTP server (on ipad/iphone) where I can connect from my MAC.
1.- Go to PythonistaFTP.py on https://gist.github.com/omz/1aec8a66a5d5d19a36ab
2.- Press the RAW button to only see the code.
3.- Copy the code
4.- Go to Pythonista and new Empty Script
5.- Paste the code
6.- As @cvp said I force to run under python2 inserting a first line on the code with this #!python2
7.- Run de code and get this error:
Downloading pyftpdlib...
Importerror: No module named pyftpdlib.authorizersAfter that tried converting code to 3 with Pythonista build in function "Python 2 to 3" and re-run code:
Downloading pyftpdlib...
[Errno 17] File exists: 'site-packages/pyftpdlib'After that I end up with a new folder "pyftpdlib-1.4.0"
That's all I have :-)
Any help will be greatly appreciated
Gus -
@brumm said:
Okay, after trying it I understand.
In Pythonista3 the module is downloaded in site-packages and not in site-packages2. After moving the directory you should insert!#python2
as first line in the PythonistaFTP code.
Yes I have tried that as @cvp said.
See my last post to exactly what I do.Thankyou
Gus -
Just try this:
- Download PythonistFTP.py
- Insert as first line
#!python2
- Change line 21 to
shutil.copytree('pyftpdlib-1.4.0/pyftpdlib', 'site-packages-2/pyftpdlib')
- Restart Pythonista (so the new module can be loaded)
-
@brumm SOLVED !!!
Thankyou
Gus