• Tito

    @enceladus hi, I’m overwhelmed for your script, I think right now is out of my capabilities, I’m just a learner and got a lot of obstacles in my way, I thought could learn Python trough Pythonista from scratch and couldn’t be more wrong.

    I hope someday could give a use to your great code and tell you.

    Thanks.

    posted in Pythonista read more
  • Tito

    @dgelessus it works, many thanks. :)

    posted in Pythonista read more
  • Tito

    Hi, i´m working on a more visual version of a little script for helping me in my job.

    The initial script was a simple console thing with prints and prompts formatted in the end.

    Now I would like to make it a bit visual importing the dialogs module.

    The documentation, after showing the function says: The edited text is returned as a string (if the dialog is cancelled, None is returned instead), and I’m unable to use the text, it disappears just with the prompt.

    Here is part of the code, I hope somebody could give me a hand.

    from sys import argv
    import dialogs, string
    
    dialogs.text_dialog(title='¿Quién es la persona destinataria de la oferta?')
    
    

    Thanks a lot...

    posted in Pythonista read more
  • Tito

    @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.

    posted in Pythonista read more
  • Tito

    @dgelessus thanks so much.

    posted in Pythonista read more
  • Tito

    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()```

    posted in Pythonista read more
  • Tito

    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.

    :)

    posted in Pythonista read more
  • Tito

    Hi, I’ve bought the book for learning Python and I’m starting to have issues in some exercises when I try to run the scrips in Pythonista.

    I’m convinced that the problem could be on file structure or the way I put the arguments because in a regular computer the scripts run ok.

    I paste the script hoping for anyone that can give me a hand.

    Thanks.

    from sys import argv
    from os.path import exists
    
    script, from_file, to_file = argv
    
    print(f"Copying from {from_file} to {to_file}")
    
    # we could do these two on one line, how?
    in_file = open(from_file)
    indata = in_file.read()
    
    print(f"the input file is {len(indata)} bytes long")
    
    print(f"Does the output file exist? {exists(to_file)}")
    print("Ready, hit RETURN to continue, CTRL-C to abort.")
    input()
    
    out_file = open(to_file, 'w')
    out_file.write(indata)
    
    print("Alright, all done.")
    
    out_file.close()
    in_file.close()
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!