Python having issues with Atom on Linux


#1

I am a Python 3 developer currently using Atom on Ubuntu 16.10, and have been having issues with Python integrations in all sorts of packages. Every single one from terminals to script executors are spitting out this error:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007fd8d3071700 (most recent call first):

I don’t know why this is happening but would appreciate any help given.


#2

Does this help?


#3

No, I don’t have virtualenv installed on python3.


#4

Just to reiterate that Python3 does work in all other programs and in CLI. Atom is the only one with issues.


#5

It has to be something in Atom’s environment. A terminal created by a package in Atom should act just like a terminal created by your emulator of choice, but its environment is inherited from Atom. But if Python is missing something that it normally uses to identify the encoding of a file, then maybe that’s a generic error that could use a better error message.

I can think of two things to test. Try running a file with explicit encoding, to see if that stops Python complaining. And apparently, the error can crop up on Linux when there’s a permissions issue, so you can check that out and see if it’s similar to your situation.


#6

I tried specifying the encoding and environment at the top of the script, and running as superuser but neither did anything to solve the problem…
I’m confused as to why this might be happening…


#7

I am as well.