omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. kaan191
    3. Posts

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 12
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by kaan191

    • RE: WKWebView in interactive prompt

      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
      kaan191
      kaan191
    • WKWebView in interactive prompt

      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?

      Cheers

      posted in Pythonista
      kaan191
      kaan191
    • RE: Since IOS 15 requests always gives me an SSL Certificate Error.

      Thanks @JonB , worked a total charm!

      posted in Pythonista
      kaan191
      kaan191
    • RE: Since IOS 15 requests always gives me an SSL Certificate Error.

      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__
      '3.7.4.post0'
      >>> requests.__version__
      '2.26.0'
      >>> certifi.__version__
      '2021.05.30'
      
      posted in Pythonista
      kaan191
      kaan191
    • RE: .readline() not working

      Did you mean .readlines()?

      Maybe show us your script

      posted in Pythonista
      kaan191
      kaan191
    • RE: Contact with the developer of Pythonista?

      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
      kaan191
      kaan191
    • RE: Next release?

      @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
      kaan191
      kaan191
    • RE: Next release?

      @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
      kaan191
      kaan191
    • vimrc to mimic Pythonista

      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?).

      Cheers!

      posted in Pythonista
      kaan191
      kaan191
    • RE: Find in files script?

      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
          else:
              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():
                  file_paths.append(item_path)
              elif item_path.is_dir() and '.git' not in item_path.name:
                  file_paths.extend(find_files(item_path))
          
          return file_paths
                  
                  
      def main():
          t = console.input_alert('text to search',hide_cancel_button=True)
          if t == '':
              return
          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
                              print(
                                  '\n%%%Found in ' + 
                                  file.as_posix().split(
                                      project_root.parent.as_posix() + '/'
                                  )[-1] +':'
                              )
                          print('l.'+str(i)+':',line.strip())
              
      if __name__ == '__main__':
          main() 
      
      posted in Pythonista
      kaan191
      kaan191
    • RE: Running simple script in background

      Brilliant @mikael thanks so much for sharing.

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

      posted in Pythonista
      kaan191
      kaan191
    • RE: Running simple script in background

      Hello,

      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
      kaan191
      kaan191