• djl

    Perfect! Thank you.

    posted in Pythonista read more
  • djl

    What is the proper syntax in the pyui custom attributes section to have a textfield input keyboard appear without the shift field highlighted by default?

    posted in Pythonista read more
  • djl

    @JonB
    Thank you Jon. That worked when I entered the argv statement followed by:

    Package_name.module_name.main()
    

    I'm just learning how all of this fits together.

    posted in Pythonista read more
  • djl

    @cvp there is no script with the functionality of the module invoked in the stash command line. The is a module with sub modules, including init

    Without understanding the answer to my original question, I did discover a workaround. If I import a submodule from the main module, I can reproduce expected output by directly calling some of the included functions. I am just surprised that this is so different than simply invoking the main module in stash.

    posted in Pythonista read more
  • djl

    @cvp thank you for your help, but my original question dealt with the python console command line, not from within a script. If one runs the module itself using the long_press method, it starts the init script and added arguments do nothing. I am just trying to replicate what happens so easily in stash, in the normal Pythonista framework, and I'm not getting anywhere.

    posted in Pythonista read more
  • djl

    @bennr01

    I tried long press to run arguments in a script, and it didn't work. I don't see such an option when using the console command line. I checked python versions and also paths in the console and in stash -- they are the same.

    posted in Pythonista read more
  • djl

    I am trying to understand the use of modules in stash and on the python console. I have a module that runs perfectly in stash with a command like:

    Module_name -s d blabla
    

    "-s d blabla" are necessary arguments in this example . I cannot figure out how to do the same thing from the Pythonista console. I can import the module, but any way I try to add the arguments, I get the error:

    SyntaxError: invalid syntax
    

    posted in Pythonista read more
  • djl

    @frapython
    I also would like to update the preinstalled matplotlib module, but I don't understand how to use

    selfupdate -f dev
    

    If that works, can you be more specific?

    posted in Pythonista read more
  • djl

    I thought of a workaround which is superior for my purposes. Redirect the downloaded file to the console:

    curl "url" -H "X-API-Key: key-goes-here" > &3
    

    Where it can be copied and pasted to a new file. If can be then read like this:

    with open('outfile.json, 'r',encoding='UTF-8') as f:
    

    This has the real advantage of preserving all of the accented vowels, etc. in the rest of the data processing. It turns out the original file was indeed UTF-8, but could not be handled by the ASCII decoder.

    posted in Pythonista read more
  • djl

    I am trying to fetch a json document that has utf-16 accented vowels and convert it to utf-8 on the output file. I have a command line in the format:

    curl "url" -H "X-API-Key: key-goes-here" -o outfile.json
    

    I can't figure out where to add something like ' .encode(utf-8)' on the command line in order to convert to utf-8. Some say this kind of command line could solve the problem:

    curl URL | iconv -f iso8859-1 -t utf-8 > output.xml
    

    But stash curl does not accept iconv , -f, or -t arguments. Is there a way to make this work in stash?

    posted in Pythonista read more
  • djl

    @JonB
    Now everything is hunky-dory. Thanks for your help, Jon. I would have given up long ago.

    posted in Pythonista read more
  • djl

    @JonB

    After rebooting the iPad, that actually worked!! Amazing! Although I notice one of my other well functioning scripts stopped working. Is that because all of the newly installed modules somehow mess up previously working ones?

    posted in Pythonista read more
  • djl

    @JonB

    import pathlib_mate.pathlib2
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/pathlib_mate/pathlib2.py", line 1203, in <module>
    from .mate_tool_box import ToolBox
    File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/pathlib_mate/mate_tool_box.py", line 6, in <module>
    import autopep8
    ModuleNotFoundError: No module named 'autopep8'

    So I installed autopep8 and tried again:

    import pathlib_mate.pathlib2

    No exceptions there. But going back to the beginning, still can't import 'Path'

    Traceback (most recent call last):
    File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/zipcode.py", line 4, in <module>
    import uszipcode.search
    File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/search.py", line 16, in <module>
    from .db import (
    File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/db.py", line 18, in <module>
    from pathlib_mate import Path
    ImportError: cannot import name 'Path'

    posted in Pythonista read more
  • djl

    >>> import uszipcode.search
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/search.py", line 16, in <module>
        from .db import (
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/db.py", line 18, in <module>
        from pathlib_mate import Path
    ModuleNotFoundError: No module named 'pathlib_mate'
    
    >>> from uszipcode.search import SearchEngine
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/search.py", line 16, in <module>
        from .db import (
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/db.py", line 18, in <module>
        from pathlib_mate import Path
    ModuleNotFoundError: No module named 'pathlib_mate'```
    
    
    
    SQLAlchemy installed, sort of...
    EAB0EA45C0A1/tmp//SQLAlchemy-1.2.17.tar.gz (5670715 bytes)
       5670715  [100.00%]
    Extracting archive file ...
    Archive extracted.
    Running setup file ...
    WARNING: Extension modules are skipped: [<__main__.OmniClass object at 0x10d4be940>, <__main__.OmniClass object at 0x10d4be080>, <__main__.OmniClass object at 0x10d4be128>]
    Package installed: SQLAlchemy
    [~/Documents]$ 
    
    But after that -- same failure to import SearchEngine
    
    And after installing pathlib_mate:
    
    >>> import uszipcode.search
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/search.py", line 16, in <module>
        from .db import (
      File "/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/db.py", line 18, in <module>
        from pathlib_mate import Path
    ImportError: cannot import name 'Path'
    
    This is not for the faint of heart

    posted in Pythonista read more
  • djl

    import uszipcode doesn't produce an error message. Referring to it from the command line produces: ```

    uszipcode
    <module 'uszipcode' from '/private/var/mobile/Containers/Shared/AppGroup/33F42B57-E4B9-4767-9D62-5D195D377333/Pythonista3/Documents/site-packages-3/uszipcode/init.py'>```

    Trying to import the search engine brings this response:

    >>> from uszipcode import SearchEngine
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: cannot import name 'SearchEngine'```

    posted in Pythonista read more
  • djl

    I have been trying to install the uszipcode package which is available on PyPI. It looks like a pure python package, and seems to install without problems with pip. Nonetheless, after trying from uszipcode import SearchEngine I get the error message "ImportError: cannot import name 'SearchEngine'" despite the fact that the class SearchEngine is clearly visible in the site package module. I feel like I'm missing something basic about installing and using python modules. Can anyone explain where I've gone wrong?

    posted in Pythonista read more
  • djl

    Right. And if the enhanced Alex voice has been downloaded, you get one more at the end:

    [AVAlexSpeechSynthesisVoice 0x28210ce80] Language: en-US, Name: Alex, Quality: Enhanced [com.apple.speech.voice.Alex]
    

    posted in Pythonista read more
  • djl

    @cvp Very interesting. Do you have a complete list of of the Objective-c number codes for each available Siri voice?

    posted in Pythonista read more
  • djl

    @cvp Thanks! It turns out that console.open_in is the only additional code I need for my project. As a beginner, I was unaware of this statement.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!