• kaan191

    Thanks @JonB ; it's more the latter, it ceases up the second you press full stop (and doesn't even show the "." following the instantiated object).

    And yes I'm referring to @mikael 's pythonista-webview.

    It's not a biggie in any case, was just wondering if the same happened to others.

    posted in Pythonista read more
  • kaan191

    Hi all & @mikael

    Substituting WKWebView for ui.WebView in one of my scraping routines worked like a charm - thanks and excellent work!

    While testing my way around the wkwebview library, I found it impossible to work with an instance of the WKWebView class. If I stored an object into variable "w" for instance, the instant I press full stop (which brings Pythonista auto complete up), Pythonista simply ceases/freezes, and I have to force quit the app (I've waited for minutes to see if it would uncease).

    Like I said, it works fine in scripts, just can't work with it dynamically in REPL as I could with ui.WebView. I've done a clean Pythonista install, behaviour is the same.

    Is this expected behaviour?


    posted in Pythonista read more
  • kaan191

    Thanks @JonB , worked a total charm!

    posted in Pythonista read more
  • kaan191

    This worked for my http calls using the requests library

    However, I have an asynchronous program making requests with the aiohttp library. These still throw the SSL Certificate errors...

    Cannot connect to host ****** ssl:default [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)]

    I'm not sure it has to do with iOS 15... my phone isn't upgraded yet and it's throwing the same errors. Most likely to do with this: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

    >>> aiohttp.__version__
    >>> requests.__version__
    >>> certifi.__version__

    posted in Pythonista read more
  • kaan191

    Did you mean .readlines()?

    Maybe show us your script

    posted in Pythonista read more
  • kaan191

    I'm sure I wouldn't be alone in willing to pay for a subscription (like Working Copy) or regular one-off payments for standard library upgrades...

    posted in Pythonista read more
  • kaan191

    @JonB it's very very slow

    To the point it's not practical for projects with big dependencies.

    So far, combo of Raspberry Pi, Blink Shell is best iPad-based platform for me; editing on Pythonista and using Working Copy where possible.

    posted in Pythonista read more
  • kaan191

    @ccc use the alpine package manager

    apk add python3

    Other useful packages

    apk add py3-virtualenv
    apk add py3-pip
    apk add vim

    Don't forget to run apk update before any installs.

    I've just started exploring iSH and I'm super impressed with the project.

    What you gain is extreme flexibility. What you lose out on - that you had with Pythonista - was a supreme UI experience.

    posted in Pythonista read more
  • kaan191

    Hi everyone,

    I love everything about Pythonista on my iPad - it's where I'm most productive; so much so that I dread having to spin up the PC to run or test a piece of code where the dependencies won't work with Pythonista.

    Using an SSH app (blink) and a virtual private server to an Ubuntu instance (digital Ocean) is turning out to be a decent halfway house, using the Vim text editor, and tmux to keep long programs running on the cloud.

    Not sure if anyone else does this.

    And if so, curious if anyone has ventured as far as to customise their vimrc file to resemble the Pythonista environment (key bindings, auto complete, file browser, etc?).


    posted in Pythonista read more
  • kaan191

    Slight adjustment to above script so that all files in project directory are found. Note: requires hard-coding the directory that holds project directories. Standard Pythonista projects sit in the Documents directory. Working Copy projects sit in a directory called Repositories. Etc. Etc.

    import console
    import editor
    import os
    import pathlib
    import ui
    # "parent" directories that contain project roots
    ROOTS = ['Documents', 'Repositories']
    def get_project_root(path):
        '''Determines the root of the project, returns PosixPath()
        if path.parent.name in ROOTS:
            return path
            return get_project_root(path.parent)
    def find_files(path):
        '''Recurses through project tree, returns PosixPath() list of all files
        file_paths = []
        for item in os.listdir(path):
            item_path = pathlib.Path(os.path.join(path, item))
            if item_path.is_file():
            elif item_path.is_dir() and '.git' not in item_path.name:
        return file_paths
    def main():
        t = console.input_alert('text to search',hide_cancel_button=True)
        if t == '':
        t = t.lower()
        path = pathlib.Path(editor.get_path())
        project_root = get_project_root(path)
        files_list = find_files(project_root)
        for file in files_list:
            if os.path.splitext(file)[-1].lower() in (".py", ".txt"):
                with open(os.path.join(path, file), mode='rt', encoding='utf-8') as fil:
                    content = fil.read().lower()
                lines = content.split('\n')
                first = True
                for i, line in enumerate(lines, 1):
                    if line.find(t) >= 0:
                        if first:
                            first = False
                                '\n%%%Found in ' + 
                                    project_root.parent.as_posix() + '/'
                                )[-1] +':'
    if __name__ == '__main__':

    posted in Pythonista read more
  • kaan191

    Brilliant @mikael thanks so much for sharing.

    I'll dig into this and post back if I run into trouble.

    posted in Pythonista read more
  • kaan191


    First post here. But have been quietly admiring all the contributions from some of the heroes of this forum. (@mikael, having particularly a lot of fun with your JSWrapper for webviews! I scrape a lot...).

    Anyway, I'm not trying to bring this topic back to life, rather, I'm curious if you @mikael have any example scripts of how you communicated with a remote Raspberry Pi server?

    I've just bought a Pi 4 (for my kid, but also for me really) and haven't managed to spend much time with it yet.

    The use case I'm trying to explore is whether I can send commands (via Pythonista or some other way) to get scripts to run on a remote Pi device. I have Blink Shell (also a nice app) but as I understand it the session closes when the app closes or is too long in the background, and I need it to keep running.

    Warning: I'm very much an amateur in all these matters so forgive me if what I'm asking / saying seems dumb.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!