Python Forum

Full Version: posting without code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how should one post without code?

is it valid to ask a question without including any code?

what if i want to just understand the general meaning of an error message?

when i run into an error in a program i often get an error message.  the other major error result is incorrect output.  another is that the program does nothing.  if i did get an error message the (approximately) first thing i do is try to understand what the error message means.  most of the time it is a syntax error.  my most common mistake is forgetting a trailing ) from the previous line.  so i usually need to get the line number from the traceback and look there or the line above.

but in rare cases i don't understand the error message.  why can't i just ask about that without the code?

it is common for us to want to see minimal code.  but these would be questions along the lines of why does my code failat that?  seeing the code helps.

minimizing the code helps.  it also helps debugging.  i have a funny story about that from days long ago which i may post later.

but i want to at least try to understand each step along the way.   dealing with, or getting the most information from, the error message is one of the first.

i don't like long code.  if someone posts a question asking why their code failed, and code is long, i usually just skip over it.   if i were a moderator, i might have to do something, but i am not.  this is why minimized code is better.  since it is usually a good debugging process, it should be done, anyway.  that gets us into the mindset "post the (minimal) code"

i just want to understand if we always need to post code here.  maybe that "post the (minimal) code" mindset has blurred us into thinking we need to see the code more often.
Thats what discussions are for. Whereas General Coding Help pertains to a particular piece of code the person is asking about.
It is fine to post with out code under the following circumstances (in my own personal opinion of course):

1) You don't expect the answer you receive to include code.
2) Not having the code does not hinder the ability to answer the question.

I think a lot of conceptual questions could fall into this category.
Then again, just because the question doesn't require code doesn't mean we don't want to see evidence that attempts were made to find the answer prior to posting.
if a program you are working on or have worked on (but generally in use now), fails, what steps might you do first?

skaperen:

try to understand the error message.

verify the correct program is being run, with correct arguments where applicable, correct data, and so on

if it has been a while, try to make sure the system is good for it (has enough memory, enough file space, proper permissions, data security, etc).

look at the source code, at the line indicated in the error message, and the previous line, first.

there is an extra line after the line that begins with "verify".  i tried to remove it, but when i Update Post, it gets added back.  it's more than just bad rendering into HTML, it's'n the buffer when i do Edit.
It's good to ask a question with no code or error message posted. It depends on how you are asking and what is your question about.

In general what I am doing if I have to write more than fifty lines ( for instance ) of code. Maybe this is small code for most of you but I am not a programmer and do not have experience. I have to watch myself what I am doing. Big Grin 
I do pseudo code in human language as a skeleton and then step by step write the code. This prevents me from admitting logical bugs in the program. Most of the times.
When an error appears I try to understand the error type, see the line and the previous one. I check the documentation for the pointed piece of code ( I have issues yet with an understanding of how the things work for a particular module or some Python specifics ). If I don't get it, I am looking for a tutorial or how to.
Often I get errors when I expect a single value is returned but it is a list or a dictionary and vice versa.