You are not logged in.
Python3 has stopped working on my system.
calling python|3 from the command line gives:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)
so Py-Initialize fails while it tries to load encodings. This suggests there may be something wrong with the python path.
However, I never messed with the PYTHONPATH or PYTHONHOME variables. Indeed, I never use python3myself, only python2.
I tried using strace on the call to python3 and here is a fragment of the output just before python3 crashes:
13622 stat("lib/python34.zip", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python34.zip", 0x7fffe4ccaa60) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/", 0x7fffe4ccaa60) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/plat-linux", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/plat-linux", 0x7fffe4ccaa60) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/lib-dynload", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib", 0x7fffe4ccafe0) = -1 ENOENT (No such file or directory)
13622 stat("lib/python3.4/lib-dynload", 0x7fffe4ccaa60) = -1 ENOENT (No such file or directory)
13622 write(2, "Fatal Python error: Py_Initializ"..., 69) = 69
13622 write(2, "ImportError", 11) = 11
13622 write(2, ": ", 2) = 2
13622 write(2, "No module named 'encodings'", 27) = 27
13622 write(2, "\n", 1) = 1
13622 rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
13622 tgkill(13622, 13622, SIGABRT) = 0
13622 --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=13622, si_uid=1000} ---
13622 +++ killed by SIGABRT (core dumped) +++
All those paths seem definitely wrong, as they are truncated.
Help appreciated.
Last edited by stefano (2014-06-01 23:25:26)
Offline
The encodings module is part of the base python package. Have you tried reinstalling it?
Offline
I did. I reinstalled python3 and even rebooted the system. Nothing changed
Offline
You keep saying "python3", we are talking about the "python" package, right?
Do you have /usr/lib/python3.4/encodings/__init__.py?
Last edited by Scimmia (2014-06-01 23:49:32)
Offline
Yeah, sorry. I keep saying python3 for clarity, because I also have python 2 installed. I mean I have the standard python package installed, and indeed
/usr/lib/python3.4/encodings/__init__.py is where is should be.
Offline
I didn't see your edit to the OP until just now. What is the output of `echo $PYTHONPATH`? Those truncated dirs do seem to point to that.
Offline
The output of echo $PYTHONPATH is nil. It is not set
Offline
Let me correct that, I was messing around with the environmental variables trying to fix things and forgot to restore them.
The output of echo $PYTHONPATH is
.:/usr/lib/python2.7:
Offline
Your first answer was better, it shouldn't output anything unless you have packages that put libs elsewhere.
For reference, here's the same section when I do an strace of python:
stat("/usr/lib/python34.zip", 0x7fffdd8fad80) = -1 ENOENT (No such file or directory)
stat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=106080, ...}) = 0
stat("/usr/lib/python34.zip", 0x7fffdd8fa800) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=3874, ...}) = 0
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=3874, ...}) = 0
stat("/usr/lib/python3.4/", {st_mode=S_IFDIR|0755, st_size=3874, ...}) = 0
openat(AT_FDCWD, "/usr/lib/python3.4/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 201 entries */, 32768) = 6632
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
stat("/usr/lib/python3.4/encodings/__init__.cpython-34m.so", 0x7fffdd8faa40) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/encodings/__init__.abi3.so", 0x7fffdd8faa40) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/encodings/__init__.so", 0x7fffdd8faa40) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python3.4/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0
stat("/usr/lib/python3.4/encodings/__init__.py", {st_mode=S_IFREG|0644, st_size=5067, ...}) = 0
open("/usr/lib/python3.4/encodings/__pycache__/__init__.cpython-34.pyc", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3858, ...}) = 0
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=3858, ...}) = 0
read(3, "\356\f\r\nfAzS\313\23\0\0\343\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0@\0\0"..., 3859) = 3858
read(3, "", 1) = 0Offline