Forum Archive

Learn Python the Hard Way: ex13

ced

Good evening,

I am currently trying to execute an 'argv' command similar to one found in exercise 13 of this book.

Currently, I am having issues with the syntax and am receiving 'invalid syntax' errors.

Is there anyone here that is familiar with this book as well as pythonista that could let me know if pythonista has limitations making it difficult to solve this exercise?

cc

Omega0

You probably left out a comma somewhere or are you typing $ Python ex13.py to run it?. I tried the example and it worked perfectly.

ced

I've tried all variants:
Ex13.py var1 var2 var3
Python ex13.py var1 var2 var3

I really don't know where my mistake is.

omz

It might be worth noting that you can hold the run button for a second in order to pass arguments to it. This is different from how you'd usually do this on a desktop computer.

ccc
  1. Paste the text of the exercise into the Pythonista editor.
  2. Tap and hold the "run" button in the upper-right corner of the screen. The hold should last for a second or two.
  3. If you held the "run" button down long enough the a Run With Arguments text entry dialog will appear.
  4. Type "one two three" (with no commas) and tap Run.
  5. Rock and Roll...
ced

Is there any way to reproduce this from the command line perspective?

If I'm following this book as a resource to help me learn python, is there any way for me to const the pythonista documentation and find out where exactly pythonista deviates from the regular desktop applications?

Cheers

Edit: thank you much omz and ccc for the FYI. I've got it to run. Spent roughly 5 hours trying to figure this one out xD

ccc

You could do so using Shellista but don't go there yet. Command lines are for the previous millennium.

Instead, just recognize that an iPad is not a desktop computer and that means you do things slightly differently on an iPad than on a desktop computer. Typing into a dialog box is not that hard.

[deleted]

"you can hold the run button for a second in order to pass arguments" ... does anyone else find this causes a crash? I've tested it on IPad mini (original) and iPhone 4, both from a clean startup of Pythonista... both crash immediately you click 'Run'

ccc

@ced Pythonista docs are available at http://omz-software.com/pythonista/docs or in the Pythonista app under the "?" icon at the upper right of the screen.

ced

@ccc Thank you much for the help provided this weekend.

omz's applications are game changing!