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.
Python 3.x Progress Update
-
@mikeyleo What's the text routine?
unicode
is a Python 2 thing. -
@mikeyleo @Webmaster4o Sounds like a bug in the
scene
module, I'll look into it. -
@Webmaster4o about your wish list for apps...
Yeah, I have had both of those apps that you want. Textastic is great, and Codea is AMAZING.
-
If I create in Pythonista3 a new file in the Pythonista 2 folder, the app is crashing. The same if I try in Pythonista 2 in Pythonistas3 folder., Maybe I am not allowed to do this?
-
Is there a way to do a pip install with Pythonista 3 as yet?
-
@Phuket2 Go to https://pypi.python.org/ and copy the Python 3 source download link for the package you want, download it in Pythonista 2 using stash, extract the archive and move the module file or package folder into Pythonista 3's
site-packages
. It's by far not as nice as using stash'spip
, but Pythonista 3 is literally a few days old, times are going to be a little rough:)
-
@dgelessus , thanks. I sort of thought you could do that also. It was not urgent otherwise I would have tried that way.
Have to say the folder system going on between the 2 apps is pretty cool.
IN Pythonista 3, I just added a script to the tool menuimport editor, clipboard clipboard.set(editor.get_path())
Just nice simple way to get file path names from inside the 2 dir. Simple, but good at this early point
-
@dgelessus , look I am very new to this. But from searching on the web it appears to me that pip is included in the Python dist and has been for sometime. Not 2.7 but after.
-
@omz signed up for the beta! Can't wait to get my existing code converted over to Python 3!
-
@omz
I am aware that @dgelessus has reported issue forsys.exit
. However my experience is a bit different. Thesys.exit
now seems to generate aKeyboardInterupt
instead of theSystemExit
exception. The code can be traced back to line 48 ofpythonista3_startup.py
, in_exitfunc
.If possible, I would like to have
exit
still generateSystemExit
in future revision. -
@Phuket2
pip
is included in almost every normal Python distribution, but that doesn't make it part of the standard library. Besides,pip
is written for normal computers and doesn't run well in the iOS/Pythonista sandbox. See https://github.com/dgelessus/fistutils for my less-than-perfect attempt to makedistutils
/setuptools
/pip
work on Pythonista. -
@dgelessus , ok. As I say, I know I don't understand. It's all a layer cake 😱
There is so much context you have to sort of be aware of when reading about Python, and that's a shame. -
@wnMark said:
I tried to run some programs with 3000001, but I failed in some cases.
After fixing the errors, I tried to run a program, but it didn´t start and I also get no error message.
Then I tried to provocate some errors and deleted some double points and after I get the error hint, I added these double points back. And so I go down in the listing and suddenly the program starts.
Some hints?
In the meantime I was able to migrate my biggest Python program to Python 3.x (and it still runs on Pythonista 2)
- print must have brackets now: print ("Hello world") instead of print "Hello world"
- Unequal must be != instead of <>
- Und I must divide 10//5 instead of 10/5 to get 2 and not 2.0
So far so good. But the last point was a little bit more tricky
4. Some (not all) spaces instead of tabs prevent the program to run. But there was no hint or error message! If hope there will be a hint in next version! -
-
@omz In Python 2 you could write
<>
instead of!=
, I think that's what @wnMark is referring to.Also, more issues - when I use Pythonista 3 for a while (15 minutes or so?), it starts reacting slowly and crashes shortly after. I'm not exactly working with huge files - I have one tab with a short 5 line file, and a second one with an "average" Python file (stash's
system/shio.py
), and other than that I check things in the console and the Python docs every now and then. I don't have any such issues in Pythonista 2. My device is an iPad mini 1 running iOS 9.2.1 and I'm using an external Apple wireless keyboard.Other minor issues:
- The syntax highlighter considers the
u
prefix ofunicode
literals (as inu"üñìcødé"
) part of the string, but not theb
prefix ofbytes
literals (as inb"PK\x03\x04"
). - In the interactive console, the tab key on hardware keyboards does not expand the first autocompletion suggestion, unlike in the editor.
- The syntax highlighter considers the
-
@dgelessus , just as a side note. I read somewhere not to use the operators in Python unless some syntax requires it. Use 'not' instead. Was simple advice, but almost never need to use the in equality operators.
-
Using
<>
really is not recommended, it was only kept for bachward compatibility with Python 1. I have never seen any actual Python code use it. Though I don't see what's wrong with!=
. Would you rather writenot option == "default"
instead ofoption != "default"
? And would you writenot option is None
rather thanoption is not None
? -
@dgelessus , I would take option is not None. But when starting Python I was thinking c. So != && <> kept popping up in my mind
-
@wnMark said:
- Some (not all) spaces instead of tabs prevent the program to run. But there was no hint or error message! If hope there will be a hint in next version!
I am fine with != instead of <>
But the issue are the spaces, that prevent the program to run
-
Python 3 is a little more picky when you use tabs and spaces in combination, and rightfully so. The issue when you mix tabs and spaces is that while a space has a fixed width (one character), a tab does not. Some people say tabs should be 8 characters, some say 4 or 2. This means that when you use spaces to indent one line and tabs to indent the next, everything will look fine to you, but someone else with a different tab width, or the Python interpreter, will be confused.
In Python 2 I think it was assumed that tabs are equivalent to 8 spaces, in Python 3 this was changed. Now tabs are considered a different type of indent that is not equivalent to any number of spaces. You can still mix tabs and spaces (but please don't) as long as it doesn't contradict any previous indentation. For example this is valid Python 3 (
\t
represents a tab):if True: if True: \tprint("works")
But this is not:
if True: if True: \tprint("doesn't work")
Normally Python 3 should raise a
TabError
for the second script, but for some reason that doesn't happen in Pythonista.