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.
Learn Python the Hard Way with Pythonista
-
hi, I just copied your code, and it works properly after providing arguments.
only that I can only "hit RETURN to continue",
and I don't know how to press "CTRL-C" on iOS keyboard. -
@shtek In Pythonista, the "stop" button (X in a square, in the console toolbar) has the same function as Ctrl-C in a regular terminal.
-
Or two finger swipe down on the main screen of the app.
-
@ccc, for clarity: two-finger swipe only works in a UI application, and even there only if the title bar is hidden, right?
-
@mikael I tested a bit, and that seems to be exactly right. Two-finger swipe down did nothing if there was no custom UI presented or if it had a visible title bar. It only did something when the title bar was hidden, and even then I think it only closed the view and didn't raise a
KeyboardInterrupt
(which is what Ctrl-C and Pythonista's "stop" button does). -
Finally it worked! the problem was the script location (iCloud), created both files in local and named correctly in the arguments and execution went ok.
Thanks for your help guys, you’re awesome.
:)
-
Hi , I´m with problems again, sorry to bother you.
This script runs ok in the author´s video but it´s no giving any result in Pythonista, this time is not a matter of arguments.
Hope someone could give me a hand.
# this one is like your scripts with argv def print_two(*args): arg1, arg2 = args print(f"arg1: {arg1}, arg2: {arg2}") # ok, that *args is actually pointless, we can just do this def print_two_again(arg1, arg2): print(f"arg1: {arg1}, arg2: {arg2}") # this just takes one argument def print_one(arg1): print(f"arg1: {arg1}") # this one takes no argumentss def print_none(): print("I got nothing.") print_two("Zed", "Shaw") print_two_again("Zed", "Shaw") print_one("First!") print_none()```
-
On its own, this code only defines some functions, it doesn't do anything that you can see. If you want the code in the functions to run, you need to call one of the functions somewhere, for example you could call
print_none()
at the bottom of your script. It looks like you're already trying to do that, but theprint_none()
call is inside theprint_none
function (because it's indented). If you wantprint_none()
to be called when you run the script, you have to remove the indent on that line. -
@Tito Hi Tito, I recently used this same book (which I checked out of the Gold Coast Library, Qld). It is hard as it builds skills through repetition and each chapter builds on the previous so you can;t really jump ahead. I found it useful up until it started on "Object Oriented" stuff. I think you should rename the book "Learn Python an even Harder Way with Pythonista" but if you're new to Python I'd recommend "Python, in easy steps" by Mike McGrath as a better intro. This book is also available at the same library (if by some weird coincidence you're in GC).
-
@dgelessus thanks so much.
-
@nev hi, it’s my feeling, that I made a weird mix and paying now for it.
I’m from Spain, bought pdf online from author, i will try to look for Mike McGrath one.Thanks.
-
- I think you should rename the book "Learn Python an even Harder Way with Pythonista" *
Sounds like a plan :)
-
@Tito I think Learn Python the Hard Way is actually a great learning tool. If you bought Zed’s course then you have a great community there to ask questions as well.
Plus learning to work in Bash will help later if you want to try some physical computing later with a raspberry pi (lots of fun).
If you want to mimic Bash a bit in Pythonista there is always Stash.