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 :)
-
@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
-
@Matteo An approach to enable fstrings in 3.1:
In stash:
pip install tokenize_rt
Then, Download future_fstrings.py, and install into site-packages-3.
Create usercustomize.py in site-packages-3, which includes
import future_fstrings future_fstrings.register()
(Iirc, pythonista_startup doesnt get executed by the extension, but usercustomize.py does)
Finally, add
# -*- coding: future_fstrings -*-
to the top of any file where you want fstrings enabled, such as zrzka's script.
-
Hi @JonB, thank you for suggestion! I will try your procedure.
@enceladus thank you for showing me an other way to do what I ask: when I will be able to use @zrzka script with python 2.7.12 by trying to copy the code here (as you suggest) in clipboard, I will try also the @omz script!
Regards
-
Hi @JonB , your procedure works very well! @zrzka script works very well in Pythonista version I use, Thank you guys!
Regards
-
Guys, below in the snippet is a func 'pythonista_info'. I am pretty sure @JonB wrote this function a long time ago. It still seems to work ok. My wapper to copy it to the clipboard is not so nice(user friendly). But a refined version of what is below could be used as a wrench item to get details about the env when you are posting to the forum. I didn't attempt to make a nice version of it. I think others would do a better job than me.
This is quite old, so maybe it does need updating...
import clipboard, console import os, platform, plistlib, scene, sys def pythonista_info(): plist = plistlib.readPlist(os.path.abspath(os.path.join (sys.executable, '..', 'Info.plist'))) ios_ver, _, machine_model = platform.mac_ver() return dict(pythonista_ver_str=plist['CFBundleShortVersionString'], pythonista_ver_num=plist['CFBundleVersion'], ios_ver_str=ios_ver, screen_resoultion=scene.get_screen_size(), screen_scale=scene.get_screen_scale(), machine_architecture=platform.architecture()[0], machine_model=machine_model, ) if __name__ == '__main__': info = pythonista_info() str_info = "\n".join(str((k, v)) for k, v in info.items()) clipboard.set(str_info) print(str_info) console.hud_alert('Pythonista Env copied to clipboard')
-
@Phuket2 Immediately integrated in my apps/tools
-
Regarding the pythonista_info function I posted above. I have since had a few freezes with using it (Pythonista becomes unresponsive) and a hard restart is required.
Ok, I found the original post, its over 2 years old. @ccc , @JonB and @dgelessus all helped out on this post. It would be nice if anyone could see why it would be intermittently freezing now. I can imagine quite a few things have changed in 2 years :). Anyway, it would nice to have it stable or an equivalent for easily getting your devices info, to be able to paste into posts if needed. I realise the dict keys could be better if they are to be used as part of the output.
@cpv, have you had a freeze using it?
-
@Phuket2 No freeze but not used a lot...
-
@cvp , ok thanks. There is something wrong though, if I use it multiple times I can get it to freeze. Hopefully someone will spot the problem
-
@Phuket2 I've corrected a serious error 😂