This was caused by a bug in
pipwhen 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
It cannot be done.
greenletdoes not work in Pythonista.
greenletis 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.
I tried to download setuptools and copy its
import pygaljust worked. Maybe we can make this a standard process to install
pkg_resourcesthe first time stash
By the way, these are the commands I used to install
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.
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.
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 definedwhich 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
pwhich is in fact the first character of
ctypes.pythonapialways points to the C API of Python 3 regardless of the default interpreter setting. Is there anyway to access the Python 2 version of
pythonapiobject? 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
Although it seems to load the Python 2 API and
Py_GetVersiondoes 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.