Python3 code runs on MacOS command line but not in Atom?


I’m running OSX Yosemite 10.10.5 with Python 3.6.0, normally I only write short 10-20 line scripts to reformat JSON etc as a replacement for grep/awk/sed and just use vi or idle to write the code, but I’ve tried to pick up Atom since I need to write some more serious stuff. But there are some oddities with code that runs when I type “python3”, but not when I press ctrl-r in Atom.

I think I have configured “runner” correctly in Atom:

python: “/usr/local/bin/python3”

Here’s one particular and rather trivial example, written in/saved by Atom::

import urllib.request
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
x = urllib.request.urlopen(‘’)

When I try this on the command line it works fine:

$ python3
b’\n\n Server is up\n\n\nServer is up\n\n\n’

However when I press “ctrl-r” in Atom I get:

Traceback (most recent call last):
File “/Users/user/Desktop/PYTHON/urltest/”, line 2, in
import urllib.request
ImportError: No module named request

I’ve tried configuring “runner” with “/Library/Frameworks/Python.framework/Versions/3.6/bin/python3” but no luck…

Have I misconfigured my Atom wrong?

Thanks in advance!


OK so I tried this on Windows, in Visual Studio Code, when running the code with shift-ctrl-b it executes fine there. But not with Atom on a Mac :frowning:


I noticed in your tests on your Mac that you’re doing different things. You’re telling atom-runner to execute /usr/local/bin/python3, but in the Terminal you’re typing python3 Those should the the same, but what if they aren’t?


HI there, thanks for the reply, good thinking but the binaries are the same
$ ls -l /usr/local/bin/python3
lrwxr-xr-x 1 root wheel 69 7 Feb 09:49 /usr/local/bin/python3 -> …/…/…/Library/Frameworks/Python.framework/Versions/3.6/bin/python3

Now, rather embarrassingly it’s all working now, with no changes from yesterday except for a reboot. I didn’t log out completely after installing the latest Python and Atom, and today when I thought I’d try to figure it out again - well it just worked. That’s obviously a :slight_smile:


Well, problem solved. :slight_smile: