• JonB

    If you are talking just about pythonista, there is a theme system accessible via settings, that let's you define the editor colors.

    If you mean system wide, there is a way to adjust gamma settings, that affected system wide colors.

    posted in Pythonista read more
  • JonB

    I will also say, that running pip install plotly with latest stash caused pip to install all of the plotly folders into site-packages-3, instead of the plotly folder, which totally borked pythonista, and it crashes immediately upon open, even with safemode and pythonista3://. could possibly be my fault for hitting ctrl-z during the process.

    so... don't do that

    posted in Pythonista read more
  • JonB

    I finally got around to trying this on the latest stash. @bennr01, it seems the issue is that pip is not detecting doendencies using the whl.

    Because of this, it is necesary to manually instal each dependency:

    rm -f site-packages*/requests
    rm -f site-packages*/chardet
    rm -f site-packages*/idna
    
    pip install requests
    pip install chardet
    pip install idna
    

    Do this all before running any other pip commands after starting the app.
    The last three must be done within a single sesson.
    Then force quit pythonista. import requests, and all should be happy.

    @bennr01 here is the whl install, showing it couldnt find dependencies.

    [~/Documents]$ pip install chardet
    Querying PyPI ... 
    Downloading package ...
    Opening: https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
    
    Save as: /private/var/mobile/Containers/Data/Application/06FD02C2-F3B4-4512-8629-018C9F64EA15/tmp/chardet-3.0.4-py2.py3-none-any.whl (133356 bytes)
        133356  [100.00%]
    Installing wheel: chardet-3.0.4-py2.py3-none-any.whl...
    Extracting wheel..
    Extraction finished, running handlers...
    Running handler 'WHEEL information checker'...
    Wheel generated by: bdist_wheel (0.29.0)
    Running handler 'dependency handler'...
    Running handler 'top_level.txt installer'...
    Copying /private/var/mobile/Containers/Data/Application/06FD02C2-F3B4-4512-8629-018C9F64EA15/tmp/wheel_tmp/chardet-3.0.4-py2.py3-none-any.whl/chardet -> /private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/site-packages-3
    Running handler 'console_scripts installer'...
    Cleaning up...
    Package installed: chardet
    [~/Documents]$ pip install idna
    Querying PyPI ... 
    Downloading package ...
    Opening: https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
    
    Save as: /private/var/mobile/Containers/Data/Application/06FD02C2-F3B4-4512-8629-018C9F64EA15/tmp/idna-2.8-py2.py3-none-any.whl (58594 bytes)
         58594  [100.00%]
    Installing wheel: idna-2.8-py2.py3-none-any.whl...
    Extracting wheel..
    Extraction finished, running handlers...
    Running handler 'WHEEL information checker'...
    Wheel generated by: bdist_wheel (0.32.2)
    Running handler 'dependency handler'...
    Warning: could not find 'metadata.json', can not detect dependencies!
    Running handler 'top_level.txt installer'...
    Copying /private/var/mobile/Containers/Data/Application/06FD02C2-F3B4-4512-8629-018C9F64EA15/tmp/wheel_tmp/idna-2.8-py2.py3-none-any.whl/idna -> /private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/site-packages-3
    Running handler 'console_scripts installer'...
    No entry_points.txt found, skipping.
    Cleaning up...
    Package installed: idna
    [~/Documents]$ ls site-packages-3
    
    site-packages-3/:
    Readme.md chardet idna midiutil requests
    

    posted in Pythonista read more
  • JonB

    bs4 and requests come preinstalled, no reason to update, which usually only causes issues

    posted in Pythonista read more
  • JonB

    aanother one is npdl (numpy deep learning)

    posted in General Discussion read more
  • JonB

    Only pure python, or numpy only dependencies.
    You might take a look at Tensor Slow, which seems to be numpy based tensorflow alternative.

    posted in General Discussion read more
  • JonB

    @ihf shortcuts supports x-callback-urls
    https://support.apple.com/guide/shortcuts/use-x-callback-url-apdcd7f20a6f/ios

    So, you should be able to call shortcuts from pythonista, and then have shortcuts reopen pythonista after

    posted in Pythonista read more
  • JonB

    One option is to use sagemath, which let's you run code in the cloud. If you search the forums for sagecell or sagemath, there were some scripts to allow wrench actions to run a py script on the cloud

    posted in General Discussion read more
  • JonB

    The difference is that things like CGRect and the like are structures, not full fledged objects. CGRectMake is not a real function, but an inlined function that gets optimized away by the obj compiler, and so there is nothing to call.

    You either have to find someone who has done the work and converted the library to python ctypes lib that you can import, or else do it yourself. Rubicon is a good place to look for much of the the core stuff

    posted in Pythonista read more
  • JonB

    def CGRectMake(x,y,w,h): return CGRect((x,y),(w,h))
    Basically, you have to define your own wrappers, stick them in a library that you import, along with the various constants that you need, etc, and just import it.

    See for example
    https://github.com/pybee/rubicon-objc/blob/master/rubicon/objc/types.py

    Near the end, they define many useful structs, constant structures, and non-exported utility functions. Mostly this is just pure ctypes.

    posted in Pythonista read more
  • JonB

    CGRectMake is not actually a function in the symbol table, I think it is more of a preprocessor thing.

    For things like CGRect, which are structures, not objects, you have to define the ctypes structure, then use the ctypes constructor methods, or manually set the fields. You could create your own wrapper functions that set the fields that you want to use, since sometimes there are fields that you can leave set to 0.

    posted in Pythonista read more
  • JonB

    Is there a reason you need the latest requests, vs the one built into pythonista?

    You need to check site-packages, site-packages-3, and site-packages-2, and remove (via file browser menu in pythonista, under Modules) requests, chardet, and idna folders, if present. Then force quit pythonista.

    Then import requests should work.

    Then, pip should be working again.

    If you need new requests version, you could try
    pip install idna
    pip install chardet
    pip install requests

    I have not tried this with the current stash version... A safer approach might be to use pip download, then manually unzip/untar and copy the folders manually.

    posted in Pythonista read more
  • JonB

    just set a flag at the end of setup.

    are you doing a lot of heavy lifting in setup? Do what you can in __init__, setup is specifically for setting up the scene elements.

    if you have a minimal example that demos this behavior, would be useful.

    posted in Pythonista read more
  • JonB

    Are you talking about autocomplete? Or interpreter (errors)

    With python a common problem is indenting to the wrong level, which might put your def at the wrong scope. Check the indentation leading up to the code.

    posted in Pythonista read more
  • JonB

    @omz From what I read, the file ~/.magic is checked by file before using the usual /usr/share/misc/magic.mgc, though maybe that is not documented anywhere. So you might try crafting a file there and see if you can get file to change its output.

    posted in Pythonista read more
  • JonB

    try using None for the block, just to see if it crashes.

    posted in Pythonista read more
  • JonB

    does it still crash with the same seg fault?

    posted in Pythonista read more
  • JonB

    By the way, if you are just trying to pause something until the view closes, you would use wait_modal instead.

    posted in Pythonista read more
  • JonB

    @vignesh you have to fix every .py file. Are you getting code signing errors?

    posted in Pythonista read more
  • JonB

    Well, your objc_block signature is wrong -- success (second argtypes) is a BOOL, not a c_void_p. BOOL in objc is a typedef for a signed char, or c_byte in ctypes. Note it is NOT c_bool.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!