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.
WebIDE
-
Yeah, I'm pretty sure OS X has the ability to mount an FTP server like a flash drive natively. Anyways, it should be pretty trivial to make an FTP server in Pythonista, using something like this: python ftp server example
-
Finally tried this, and I have to say: Very cool idea and impressive implementation! Thanks for sharing!
-
I wonder if it might be possible to run the server on a background thread, so that it doesn't block the interpreter, and it would be possible to add a "Run" button in the web interface...
Another interesting addition might be Bonjour support via
objc_util
(NSNetService
or something). I don't really have experience with this, so I don't know how hard that would be, but when using Safari/Mac, you wouldn't have to know the IP address of the iOS device... -
@omz From when I've used bonjour, it's really quite cool. The VNC app I use supports it out of the box, and it's really neat. With no prior setup, I can VNC into my macbook from my iPad, and I don't have anything running on the MacBook. They kind of just magically discover each other :)
-
I've implemented Bonjour support, see my pull request.
This way, "Pythonista WebIDE" automagically shows up in Safari's bookmarks menu when it's running. You may need to enable the Bonjour menu in Safari's Advanced preferences.
-
Thanks @omz! I've merged your pull request.
-
This is awesome. Thanks for making this. Now I just need to figure out a way to access it at my school computers.
-
to run the server on a background thread, so that it doesn't block the interpreter,
I tried to run it under the famous Stash shell.
but Stash only supports python 2, and this is for python 3. -
File "...WebIDE.py" with open(fullname, encoding = 'utf-8', mode = 'r') as in_file: # Open the file... TypeError: 'encoding' is an invalid keyword argument for this function
so the problem is function open
after google I added some lines like this:import sys if sys.version_info.major == 2: import codecs open = codecs.open
now it's t compatible with both python 2 and 3.
-
another little modification to support utf-8 editing:
change def submit(): # This function will get called for each POST request to / ... f.write(request.forms.get('code').replace('\r', '')) # And dump our code into it
to:
f.write(request.forms.code.replace('\r', ''))
see [https://stackoverflow.com/questions/27432211/python-bottle-requests-and-unicode](link url)
If you use the alternative direct property access request.query.q or forms.q Bottle will give you Unicode strings instead, decoded from the byte version using UTF-8. It's usually best to work with these Unicode strings wherever you can.