• ywangd

    This was caused by a bug in pip when it registers installed package, which is backed by RawConfigParser. The RawConfigParser has its own string interpolation rule which relies on the percentage sign.

    The bug has now been fixed and you can get it by selfupdate -f.

    posted in Pythonista read more
  • ywangd

    It cannot be done. greenlet does not work in Pythonista.

    greenlet is a pure C extension. It does not have any Python modules to be installed. That is what caused the error. C extension installation generally requires compiling C code which is impossible in Pythonista.

    posted in Pythonista read more
  • ywangd

    I tried to download setuptools and copy its pkg_resources sub-folder into site-packages. Then import pygal just worked. Maybe we can make this a standard process to install pkg_resources the first time stash pip is called.

    By the way, these are the commands I used to install pkg_resources.

    pip download setuptools
    tar -zxvf setuptools-25.1.0.tar.gz
    cp setuptools-25.1.0/pkg_resources site-packages/
    

    If there are any import errors afterwards, try restart Pythonista.

    posted in Pythonista read more
  • ywangd

    This is the use case that StaSh was initially created for. You can invoke your script from within StaSh similar to what you would do on a PC. You can redirect the output to a file as the follows:

    your_script.py > output.txt
    

    More details here https://github.com/ywangd/stash
    If you have previous experience with Linux shell, things should be quite familiar.

    posted in Pythonista read more
  • ywangd

    OmniClass is a stub class defined in StaSh pip. So maybe somehow it was getting in the way. Try restart Pythonista, i.e. swipe up to remove from task list.

    posted in Pythonista read more
  • ywangd

    Thanks a lot @dgelessus ! One cannot ask for a better answer!

    posted in Pythonista read more
  • ywangd

    @omz @dgelessus
    The following simple code using pythonapi works well in Python 2 but errors out in Python 3.

    import ctypes
    
    p3 = ctypes.pythonapi
    state = p3.PyGILState_Ensure()
    p3.PyRun_SimpleString('print(42)')
    p3.PyGILState_Release(state)
    

    The error is name 'p' is not defined which is very weird as it suggests that the API does not even parse the given string correctly. It somehow tries to get a variable named p which is in fact the first character of print.

    posted in Pythonista read more
  • ywangd

    Thanks @dgelessus
    The use of PyDLL worked for some initial tests!

    posted in Pythonista read more
  • ywangd

    @omz
    ctypes.pythonapi always points to the C API of Python 3 regardless of the default interpreter setting. Is there anyway to access the Python 2 version of pythonapi object? It would be even more fantastic if both of them can be accessed without switch interpreter setting.

    I also tried to manually load the library with

    ctypes.CDLL(os.path.join(os.path.dirname(sys.executable), 'Frameworks/PythonistaKit.framework/PythonistaKit'))
    

    Although it seems to load the Python 2 API and Py_GetVersion does show the version to be 2.7. But it is somehow not really usable. Many API calls working with the Python 3 API would not work or even simply crash the app.

    Any help is appreciated.

    posted in Pythonista read more
  • ywangd

    @korakot @plessner There was a bug in stash pip command that prevented it from parsing package names with uppercase letters. The bug is now fixed and you can get the updated version via selfupdate.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!