I’ve enjoyed working with Pythonista over the past year, so today when I needed to do some Markdown editing, I purchased Editorial.
I may just be mad, but for the life of me, I can’t find the files I’m creating. I want to find them so I can modify and add to them via Shortcuts and Share widgets.
But while I’ve created some files of all types, naming them with unusual strings and including unusual strings in them so that I should be able to locate them in Files via text search, I can’t. They aren’t there, in Recents, in On My iPad, or on iCloud Drive.
I found a configuration setting about Dropbox syncing, so I gave that a try, but the default folder (/Apps/Editorial) wasn’t created in Dropbox. So I created it, and tried to do a sync cycle, but nothing happened. So then I dropped a random Markdown file into that folder, and it showed up in Editorial, and if I modified it the modifications showed up in Dropbox. But the other files in Editorial aren’t there.
It’s very strange... it seems like it isn’t writing out files at all, but I force-quit Editorial and restarted it, and the Markdown documents still show up, so it must be storing the files... somewhere.
Is it using some strange hidden files or something, and if so, can I change that behavior so it just acts like Pythonista, Edidown, or any other iPad app where I can get to my files via the Files app?
I apologize if I’m missing something very basic—since no one else has mentioned this on the forum as far as I can see, I imagine I’m just not looking in the right place or forgot to toggle some setting or something. I’d very much appreciate the hint! Thanks!
I inadvertently broke
pytest— I can still long-press Run and do “Run Doctests” and they work, but if I do “Run Unit Tests” I get the traceback below,, ending with
PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Library/Mobile Documents/pytest.ini'.
I know I broke it myself: I used StaSh (with Python 3) to do a
pip install pytestbecause I was previously (when it worked) running into a bug I saw pytest had fixed. I can’t figure out how to back out the changes inflicted by running this.
Can anyone help me to fix this? Thanks!
Traceback (most recent call last): File "/private/var/containers/Bundle/Application/1F6E6781-AC43-4C6A-86CC-E1540DE81702/Pythonista3.app/pythonista_pytest.py", line 52, in <module> main() File "/private/var/containers/Bundle/Application/1F6E6781-AC43-4C6A-86CC-E1540DE81702/Pythonista3.app/pythonista_pytest.py", line 17, in main pytest.main(['--verbose', script_path, '--junitxml=%s' % (log_path,), '-p', 'no:cacheprovider']) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 143, in main config = _prepareconfig(args, plugins) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 319, in _prepareconfig pluginmanager=pluginmanager, args=args File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/manager.py", line 87, in <lambda> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/callers.py", line 203, in _multicall gen.send(outcome) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse config = outcome.get_result() # type: Config File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/callers.py", line 80, in get_result raise ex.with_traceback(ex) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse self.parse(args) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 1280, in parse self._preparse(args, addopts=addopts) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 1157, in _preparse self._initini(args) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/__init__.py", line 1080, in _initini config=self, File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/findpaths.py", line 184, in determine_setup rootdir, inipath, inicfg = locate_config([ancestor]) File "/private/var/mobile/Containers/Shared/AppGroup/D9BD8947-DFD5-470C-B1D9-66DA93B008C0/Pythonista3/Documents/site-packages-3/_pytest/config/findpaths.py", line 105, in locate_config if p.is_file(): File "/var/containers/Bundle/Application/1F6E6781-AC43-4C6A-86CC-E1540DE81702/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/pathlib.py", line 1346, in is_file return S_ISREG(self.stat().st_mode) File "/var/containers/Bundle/Application/1F6E6781-AC43-4C6A-86CC-E1540DE81702/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/pathlib.py", line 1140, in stat return self._accessor.stat(self) File "/var/containers/Bundle/Application/1F6E6781-AC43-4C6A-86CC-E1540DE81702/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/pathlib.py", line 391, in wrapped return strfunc(str(pathobj), *args) PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Library/Mobile Documents/pytest.ini'
A more direct answer, perhaps: As the StaSh README says, StaSh runs by default in Python 2, because not all of its functions work in Python 3.
But I’ve simply taken the
launch_stash.pyscript, and copied it to
launch_stash3.py, then edited the latter so that the first line is:
if you do the same, when you run
launch_stash.pyyou’ll get it in Python 2, and
launch_stash3.pyin Python 3. If you run
pipin a Python 3 StaSh, it will install Python 3 libraries.
You can also use
pip -6 install…, but I’ve found modules installed into Python 3 that way from Python 2 StaSh to be unreliable. You can
importthem, but sometimes they don’t work, and
pip listdoesn’t show them in either StaSh 2 or 3. So I just wouldn’t do it.
I have a Scene-based program where I’d like to distinguish between finger and Pencil touch events.
An example from omz showed how to do this in a
ui.View; in the
def touch_moved(self, touch): ui_touch = ObjCInstance(touch)
then, I have verified, you can check the value of
ui_touch.type()to determine if the touch is from a finger (0) or a Pencil (2).
Unfortunately, I found out if you attempt to do the same in a
touchargument to the methods is not compatible with
ObjCInstance. You get:
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
so, I’m wondering how I can get at a
Touchobject I can use the ObjC bridge with via a
See some of the examples in this thread
Those are exactly some of the cases I mentioned in my original post that make use of
consoleViewControllerand I said didn’t work. But you write:
In particular, consoleViewController is a objc method of the app delegate. There are some examples of how to get the default font.
As I wrote initially, I saw this, and none of that code works for me—the traceback says
consoleViewControllerdoes not exist. I concluded that given how old it was—and that some other forum posts I found earlier mentioned it had been removed—that it was no longer workable and couldn’t be made workable.
Does it work for you, and if so, did you need to make modifications?
There are some methods to load true type fonts... Under UIFont iirc.
As I mentioned, I tried that as well; I could at best get a path to a ttf file, but couldn’t turn that into something that I could use in
I’m quite stumped as to how to list or select fonts inside a program or from the console. There are some examples here that are said to work, but they’re from posts that are years old and depend on a
consoleViewController()method that appears to no longer exist and for which I can’t find a replacement.
There are a few fonts used in Examples programs, but unless I missed something, all of them are hardcoded.¹
Of course I can use the plus sign in the editor to select a font, but short of selecting each in turn and hardcoding them into my program so that they can, in turn, be chosen from, I can’t figure out how to give the user of my program a font chooser. (And since I have extra fonts that may not be the same as your extra fonts, even that hardcoding tactic is unlikely to work.)
When I saw that
ImageFont.truetype()had been modified for Pythonista, I thought perhaps I could use
matplotlib.font_managerto find TrueType files, but it appears the
matplotlibFontManager can only see files inside the
matplotlibdistribution (mostly Vera fonts), and even so, the FontManager’s outputs can’t be used in a
console.set_font()call or a
truetype()call—I haven’t tried other font methods outside
matplotlib, but I assume they’d act the same.
A code snippet that would simply list assign the known fonts to a list and then use one of them would at least get me started. Apologies if I’m missing something very obvious.
Btw: is there a reason that
console.set_font()either can be run with 2 valid arguments (which changes the font), or 0 arguments (which resets the font to default), but if you run, say,
console.set_font('NoSuchFont', 18), you simply get a null-op—it neither throws an exception, nor resets the font? (Also, I can’t find a
console.get_font()equivalent, even by digging through the guts of
console—it seems like the currently selected font isn’t stored anywhere.)
¹ Not all of them are directly hardcoded; some are stored in variables that then get used. But they’re all hardcoded in appearing in the text of the program rather than being programmatically found.
Please, first, try this little script without external keyboard, by pressing &h*, you will see a θ
in your input field, in any app, if you use this script as custom keyboard.
Then, don't change which keyboard is active (no globe key) and connect your Bluetooth keyboard. If your keyboard is coherent with the Pythonista QWERTY standard keyboard, the script will also work.
No—I get normal QWERTY behavior from the hardware keyboard.
For me, it does not because if I tap & or * on my keyboard, other keys are generated.
Okay, but you can work around that. Here’s a script that—if it works as you say—should put asterisks before any character you type, and since it doesn’t care about the character, it shouldn’t matter QWERTY, AZERTY, or whatever:
#!python3 import keyboard import ui class KeyboardInfoView(ui.View): def __init__(self, *args, **kwargs): super().__init__(self, *args, **kwargs) self.background_color = '#00436e' def kb_should_insert(self, text): keyboard.insert_text(u'*') return '*' if __name__ == '__main__': v = KeyboardInfoView() keyboard.set_view(v, mode='minimized')
Thus, with external keyboard, we get data but not obviously the same key as expected.
I don’t believe that’s true. Try the above script. If it outputs
*when you type hardware keyboard keys, then you are right. But it doesn’t for me. Your AZERTY keyboard shouldn’t matter in this case.
with an external keyboard, it does absolutely nothing that I can see.
I can't test anything, I don't have any external keyboard
You really don’t have access to a single Bluetooth keyboard, nor a “Camera connection” dongle whose USB port you can use to hook up your desktop USB keyboard? You don’t need a special iPad or iOS-compatible keyboard.
I’m speed throttled from replying to your multiple messages, so I’ll reply here:
Could you give an example, please
I did give three examples, in the words immediately after the ones you copy-pasted—“like Vim or Emacs offer, or RFC 1345 encoding”.
If you mean how would it work, in RFC1345 encoding you type some character to enter RFC1345 encoding—ampersand is common—and then you type a sequence of from one to three ASCII characters that mnemonically get you a character elsewhere in Unicode space. For instance, to type θ, you press
&h*—all the Greek letters are the matching letter followed by asterisk, so capital Θ is typed
&H*. There are no ambiguous subsequences, so when you finish you immediately get the character and can continue typing ASCII or another sequence starting
It’s slow for typing full texts in other languages, but for cases like International Phonetic Alphabet, math notation, or programming languages that use non-ASCII unicode, it’s quite handy. Even things like typing characters that require the ⌥ key on Macs into ASCII-only inputs.