Already picked a programming language and started learning how to code? Inevitably, you’ll need to ask for some coding help. Even the best, most experienced developers do. It doesn’t matter if you’re chatting with an instructor, emailing a listserv like NICAR, posting on Stack Overflow, or even just tweeting out a question, there are ways to make sure your question gets answered. This guide is aimed at journalists, but can apply to anyone.

Here are some guidelines:

1. Do some research first

Before you can find a solution, you need to know how to describe the problem you’re having. Read the error message out loud so you understand what’s going on. Even if you don’t understand all the words, make sure you read the whole error at least once.

Many times, someone else has had the same question as you, and asked that question on the Internet. If you have an error message, Google the exact message. Or just describe the problem you’re having and search. There’s a great post from KnightLab on how to get good answers from Google about code.

If you’re having problems with a specific project hosted on Github, checking out their issues page (here’s an example) can also be helpful. Developers frequently use Github issues as a way to log known problems, or speak to the people using their project.

If you need help with a specific programming language, there are great journalism-specific google groups that can help you, such as PyJournos and RubyJournos.

Try any of the solutions you find to see if they work for you.

If nobody’s posted an error message like yours, chances are good that you’ve made some type  of basic error (we all do it), like forgetting a semicolon, or not installing a program you need. Step through your code one last time, maybe reading everything out loud, just to make sure you’ve got everything right.

If solutions aren’t working, keep track of what you’ve tried, as well as what happened when you tried them. When you post your question, you’ll want to explain what you’ve already done.

2. Be specific

When asking your question, be specific. This means your post should include:

  • The tools you’re using, including version numbers and your operating system version.
  • What you’re trying to accomplish – what did you expect to happen if everything had worked?
  • The code you’re using (or just the relevant parts)
  • Any error messages you got
  • What you’ve tried already, and what happened

Let’s look at an example email or post, looking for programming help:

I’m trying to scrape the Boone County inmate roster using Python, and the requests and BeautifulSoup packages. So far, I’m only trying to get requests and BeautifulSoup working.

Here’s my code:

import requests
import csv
from BeautifulSoup import BeautifulSoup

url = 'http://www.showmeboone.com/sheriff/JailResidents/JailResidents.asp'
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html)
print soup

The error I’m getting says:

Traceback (most recent call last):  File "test.py", line 3, in from BeautifulSoup import BeautifulSoupImportError: cannot import name BeautifulSoup

I first checked the spelling and it is correctly imported. So, I then tried Googling for “ImportError: cannot import name BeautifulSoup”. All the help out there says that I need to install it, but I thought I did. I tried again to make sure and the following happened:

pip install BeautifulSoup
Requirement already satisfied (use --upgrade to upgrade): BeautifulSoup in /Users/jacquelinekazil/Projects/envs/scraping-class/lib/python2.7/site-packagesCleaning up..

I can’t figure out why this is happening. Please help!

Note: This is an actual example. Bonus points if you can identify what the issue is.

3. Repeat

When people start responding with solutions, try them. If the proposed solution doesn’t work, do not respond simply with “That didn’t work.” Instead:

  • Post what your updated code looks like
  • Post the new error message
  • Post anything else you were inspired to try since you posted your question

If a proposed solution does work, make sure you respond so others with the same problem will know that the solution worked. Remember to thank the person for helping you!

4. Document and share

Be sure to pay it forward. When you’ve worked your issue through, document and share everything -- your problem, the things that you tried, and the solution that worked. One day, somebody with the same problem you had will be helped enormously by this.

5. Other guides

If you want to read more on this topic: