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.
How to ask a good question
-
Here's a simple document describing how to ask a good question and why it is so important to include as many details as possible. I still feel that some people don't understand it and it's a good thing to have kind of reminder. Would be nice to have something like this as sticky topic (like Slack topic).
Forum
This forum is not a paid support. Pythonista, Editorial, ... is developed by @omz - single person. Ole tries to help everyone here, but day has 24h and he is not simply capable to answer all questions. He's fixing bugs, working on new features and also he has a life outside of Pythonista and Editorial.
We have a lot of volunteers trying to help as well. These people are doing it for free, in their spare time, ... and they decide if they're going to help or not. This decision is based on a lot of things - your attitude, time you spent on your problem, attempts you made, ... You're going to receive help if you're polite, if you show some work to solve your problem, ... It's up to you. These people invest their time, you should invest yours into detailed description of your issue at least.
Another important fact is that these volunteers live around the globe. You can have morning, but people capable to solve your issue can be in bed, ... Always think about this and wait for 24h before you ping your topic again, ... I can write a comment at 11pm, go to bed "in the middle of conversation" and you can feel I left you. That's not the truth, I just did go to bed for example. Others will help or I'll when I wake up.
And the last thing is English language. It's not that hard language like Czech, Chinese, ... for example, but no one's perfect and there're different levels of English around. Keep this in mind, some sentences can sound as a personal attack, but it can be just something like not a very good knowledge of English, ...
People are going to help, they really do, but they have a freedom to choose in what thing they're going to invest their time. Be polite, don't use words like hell, stupid acting python ide, ... if you're seeking for help.
Short version
What you should provide?
- Device, iOS version, Pythonista version
- Explain what you're trying to achieve, what's your goal
- Attach your complete project, not just part of it
- Include all related testing data (input files, ...) as well
- Include complete traceback if it crashes
- Do not try to summarise any of it, you can make a mistake
Do I have to include everything every single time I ask? Well, it depends on the problem you're trying to solve. It's not necessary sometimes. Just stop for a while, think about it and provide whatever you think it's necessary. More is always better than less.
Longer version
Device, iOS version, Pythonista version
There're differences in iOS behavior when it comes to devices like iPad vs iPhone. Same applies to different iOS versions on the same device. And same applies to different Pythonista versions on the same device and iOS.
You should update Pythonista to the latest available version before you ask your question. Issue can be solved in the newest version.
Because of all these things, you should include device information, iOS version and Pythonista version. It's more important in bug reports, but can help with your issue as well.
Explain what you're trying to achieve, what's your goal
It happens and it's not so rare. Sometimes people tend to use wrong tool a.k.a. module, approach, ... You can learn new things, get better answer / solution if you explain what you're trying to achieve.
Attach your complete project, not just part of it
What is a project in this context? Everything what is related to your problem. It can be single script or bunch of scripts (modules), input data (files, images, ...). It's always good to attach example one can run and which shows symptoms you're trying to solve. It leads to a quicker solution.
It's not so rare that your issue lies elsewhere than you think. You can have two functions, trying to solve why the second one doesn't work, you paste it here and the problem can be in the first one for example.
Also Pythonista behaves differently when your script is saved in This iPad, in site-packages, ...
Don't try to be smart, don't hide what you did, don't feel ashamed, no one's perfect. Everyone's making mistakes. I made lot of them during my career and some of them were kind of fatal. It's a life, never ending learning process.
Or you can create a Minimal, Complete, and Verifiable example as @dgelessus did point out in the comments below.
Include all related testing data (input files, ...) as well
To reproduce your problem we need your input data. Because your script can work with another set of input data. Again, this is not rare. Algorithm can be written in a wrong way and it can work when we're going to test it - input data differs - yours and ours.
Yes, it's pretty clear what's the issue sometimes. But sometimes not, can be nasty one. Less information you provide, more time it takes.
Include complete traceback if it crashes
The worst thing you can do is to summarise traceback with your words. Never do this. Attach verbatim copy of it.
Do not try to summarise any of it, you can make a mistake
If you're not able to solve your issue, you're likely going to make a mistake in your summary as well. Code, traceback, input data, ... Please, don't do this, it just slows things down. Reproducibility and accurate info is crucial. Remember what I wrote about volunteers living around the globe? If you do not include precise description it can prolong solution for several days. We're going to ask, then bed, you'll answer, but we're sleeping, ...
Invest some time, because you're asking us to invest our time to solve your problem. Answer questions we ask even if they sound like completely unrelated ones to you. They can lead to a solution you don't see yet.
How to
Code in the post
Forum supports Markdown and you can include code in this way:
Three backticks alone or followed by
python
,json
, ..., your code and another three backticks. You'll get nicely formatted, highlighted, ... code, json, text, ...Share via Gist
Create GitHub account and follow instructions. Do not update Gist when you already linked it here in the forum. Do you want to show something new you just did? Create another one.
Gist is preferred for longer code, one gist can have multiple files, ...
Attach image
It's also helpful to attach an image sometimes. Unfortunately, forum doesn't support image uploading. You can upload image to any service and just paste link.
If you want to include it in the post (not just link) do it via Markdown:

In case of Dropbox, copy image link, replace
dl=0
at the end withraw=1
:
Traceback
Do you see something like this? Tap on the expand button.
Tap on the Print Traceback row.
Close exception overlay and copy & paste the whole traceback here. Use three backticks.
Unsure what to copy? Clear console, reproduce your problem again and copy & paste whole console. You'll known that you're going to copy & paste relevant information only.
Conclusion
I wrote this, because I see that people are doing same mistakes again and again. I'm not forcing anyone to follow these instructions. If you do, you'll receive help more likely. If you don't, it's your problem which is not going to be solved. Think about it. Get a life now, go and grab some beer :)
-
Nice post, except that, in my poor English, I would write "some beersssss" 😂
-
Nicely written @zrzka!
For image uploads I would suggest Imgur (https://imgur.com/), since it provides all essential image hosting features for free without requiring a login - you can even delete images uploaded anonymously (you get a special link for that after the upload).
Although using Dropbox works, I don't think it's a very good place to host images. Once you use Dropbox to host an image, you have to keep it around in your files, or the link will break. Even if it's "just" for a support thread, broken images/links are a pain for people who read the support thread later because they have a similar issue. Also, on iOS the Dropbox app has this "feature" where any Dropbox link is opened in the app rather than the browser. This isn't a problem for embedded images, but with regular links it's quite annoying.
About posting the complete code with which the problem happens - I agree that you shouldn't leave out important info, but posting the entire code isn't always good either, especially when it's a lot of code across multiple files. If possible, try to narrow down where in your code the problem happens, and post only the code needed to reproduce the problem - this is called a minimal, complete, and verifiable example. Doing this makes it much easier for others to help, and in the process you might even figure out the problem on your own.
One other thing... we all agree that this person that you're linking to wasn't very nice, but I think they got the message. There's no need to keep bashing them, it's not going to make them a better person.
-
@dgelessus good point with the minimal, complete and verifiable example. Thanks for it.
I'm not bashing anyone, just linked it as an example (removed the link from the post few seconds ago). Tried to help even when these words were used :)
-
Idea for either a future pythonista enhancement, or an executable url:
An "Ask For Help" script/action which has the following options:- Attach last traceback(or, allow user to copy/paste) and/or faulthandler trace
* Attach current script (or select files to attach)
* Select images to attach
* Asks for detailed description, along with hints on how to write a good question.
* Automatically includes pythonista and ios version
All of this gets formatted to a forum post (using pythonista gist settings, and anonymous imgur for files/images). Ideally this would live in a separate area in the forum. We could even auto-answer or link to common threads for common problems (*$&# enum.py!), maybe even explain a few exceptions ("I see you have an AttributeError. You were trying to access an attribute called xxx on an object of type yyy, but no such attribute exists. Here is a link to some debugging ideas to try first".)
- Attach last traceback(or, allow user to copy/paste) and/or faulthandler trace
-
@zrzka Very good explanation, thank you!
Writing to this forum, I ask two things:- with Markdown can we change image dimensions directly inside the command
![(http://some-link-to-an-image)
? I've noticed that the images I post here are too large. - Often I read Pythonista forum via Safari in my little iphone: sometimes I need to copy an entire code posted by users but I can't find easy to select the full text of the codes/scripts in the forum. Do you know some other ways to quickly select (with Safari or Pythonista web browser) only all text between
</>
in order to copy the full script in clipboard (then it is easy to paste in a new Pythonista script)?
Thank you
Regards - with Markdown can we change image dimensions directly inside the command
-
Re 1 - There're many extensions doing this, but I don't know if NodeBB supports it. Search for them and try. I doubt that it will work.
Re 2 - Little bit of scripting, but doable.
Let's say you have a topic with URL like https://forum.omz-software.com/topic/4622/notification-module-api. Every comment starts with a line like Phuket2 posted a day ago. When you tap on a day ago, URL changes to https://forum.omz-software.com/topic/4622/notification-module-api/6. And now:
- You can prepend
/api
to get JSON /6
is a post number starting from 1, so, the index is6-1=5
JSON response contains
posts
, which is an array of dictionaries and every dictionary has keycontent
. You have a content now. You can get<code>xxx</code>
via regexCODE_PATTERN = re.compile('\<code.*?\>(.*?)\<\/code\>', re.MULTILINE | re.DOTALL)
.Here's code with fixed URL inside:
UPDATE: <snip>...see gist in following post, removed code & sample just not to clutter this topic...</snip>
- You can prepend
-
@Matteo decided to make your life easier :) https://gist.github.com/zrzka/7fc25156da0714daa9aa79a17898da2f
-
@omz, not sure if you can have more than one post pinned in a forum or not. But it seems to me that a consolidation of this post pinned to this forum would benefit everyone. The shame is that in a week or so, this post will get swallowed up with all the other posts. If you dont want to pin it in this forum, maybe in the General Discussion. Even if new users dont see it, it can be easily found and new users can be directed to read it to help themselves when popsing questions here.
Just my 2 cents worth -
@zrzka, impressive, as always.
I would add, at the very top, that before even asking the question, you should always search for a solution with Google or other preferred external search engine, and including the word ”Pythonista” in your search.
As well as checking Pythonista-Tools first for some reference implementations.
+1 for sticking this thread.
-
Hi @zrzka , sorry for delay, thank you very much for your help! I surely will try your procedure next weekend to make easier to copy and paste in a new Pythonista script a full script posted by any user in this forum using browser. I find a lot of useful scripts or pieces of code here.
It would be useful for any Pythonista user to have an updated first post written by you with new info about using this forum (practical info). The new info that any user can add in this thread with his/her personal post based on personal experience could be examinated and maybe, if correct and useful, added to your first post, in order to have always an updated first post about state of art in pythoning with Pythonista.
I'm agree with you about having this thread always in the first/second position from top in the forum, for fast reading.Thank you,
Regards
Bye -
getting a copy of the code from a forum-post ( code from omz)
https://forum.omz-software.com/topic/2022/a-copy-code-button-here-in-the-forum/4 -
@dgelessus, went to imgur, and it seems that login is now needed?
-
@mikael At the top of https://imgur.com/ there is a "New post" button, when you tap it you get an upload dialog that doesn't require a login. If you're not on a regular computer, you probably get the mobile site by default, which is useless and just wants you to download the app. In that case reload the page in desktop mode (in Safari, you can long-tap on the reload button to get the desktop site option).
-
@dgelessus, thanks. Still, on the phone, I have so far not found out how to get the actual link to just the picture.
-
@mikael check this https://gist.github.com/zrzka/b61c74975c777a77232035a3e171337d
- Follow instructions above line 21 to get an client ID
- This script can be run from the Pythonista or you can add it to share extensions and run it from Photos for example
-
Hi @zrzka, I'm trying to follow the steps you have suggested me and I discovered a new feature of Pythonista never tried before (sorry for my ignorance): user can create a script that can executes some operations on a web page or other files through "Share Extension Shortcuts"!
I have a little problem with the code
forum-post-copy-code.py
Info:
- iOS=10.3.3
- Pythonista = 3.1 (301016)
- I'm following the steps in this link
- I obtain an error:
File "/private......../forum-post-copy-code.py", line 17 raise ValueError(f'{url} does not point to the Pythonista Forum) SyntaxError: invalid syntax
Can you kindly help me to solve this?
Thank you
Regards -
@Matteo update to 3.2 & use 3.6 as default interpreter (the error is about f strings).
-
@zrzka If I remember correctly, @Matteo said in another thread that he isn't able to update, because of the Python 2
matplotlib
crashes in 3.2.If the f-strings are the only issue, you can probably translate them to
format
calls by hand, which work on any Python version since 2.6 or so. For example,f"{url} does not point to the Pythonista forum"
would become"{} does not point to the Pythonista forum".format(url)
. -
@zrzka Hi, ok it is a problem related to version of Pythonista, but @dgelessus is right: for now I'm happy with 3.1 version so no need to upgrade.
I understand that there is a solution for my problem without upgrade. Can you (@zrzka , @dgelessus or someone else) kindly show me how can I modify the rest of the script in order to not obtain errors related to f-string? In other words can you provide a modified version of the script working with python 2.7.12?Thank you for help
Regards