python related error reports [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

python related error reports [SOLVED]

Postby agvares on Mon Feb 11, 2013 2:48 pm

i'm just getting familiar with the whole linux structure and linux shell particularly.

something I can't still understand is this reports I keep getting whenever my command fails.

for example, if I open shell and type "mk dir ~/work/articles", I get the following:

Code: Select all
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 23, in <module>
    import gettext
  File "/usr/local/lib/python3.3/gettext.py", line 49, in <module>
    import locale, copy, io, os, re, struct, sys
  File "/usr/local/lib/python3.3/struct.py", line 12, in <module>
    from _struct import *
ImportError: No module named '_struct'


why is that so and what does it actually mean?

for that I have no idea at all.

thanks in advance for any clarification on the issue
Last edited by agvares on Mon Feb 11, 2013 5:21 pm, edited 1 time in total.
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Linux Mint is funded by ads and donations.
 

Re: python related error reports

Postby xenopeek on Mon Feb 11, 2013 3:02 pm

"mk" is not a command ("mkdir" is), so the shell tries to run the command-not-found program, which can in most cases suggest what package you should install to get the command you are trying to run. When this works, your command should reply the following:
Code: Select all
mk: command not found

So yes, something is going wrong.

Which version of Linux Mint are you using? And what did you do with Python? Because I'm on Linux Mint 14 and that has Python version is 3.2.3 as the default Python 3 version (you have a version from the 3.3 branch).

Can you share the output of:
Code: Select all
ls -ld /usr/bin/python* /usr/local/lib/python*
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14660
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: python related error reports

Postby agvares on Mon Feb 11, 2013 3:14 pm

xenopeek wrote:"mk" is not a command ("mkdir" is), so the shell tries to run the command-not-found program


yeah, I know that, just used the wrong spelling to demonstrate how inadequate my error reports are

xenopeek wrote:Which version of Linux Mint are you using?


Mint 14 "Nadia"

xenopeek wrote:And what did you do with Python? Because I'm on Linux Mint 14 and that has Python version is 3.2.3 as the default Python 3 version (you have a version from the 3.3 branch)


it's not that I did anything except for installing the 3rd version (since i'm reading a textbook on the version 3.3)

xenopeek wrote:Can you share the output


sure, here it is:


Code: Select all
lrwxrwxrwx  1 root root        9 февр.  8 19:20 /usr/bin/python -> python2.7
lrwxrwxrwx  1 root root        9 февр.  8 19:20 /usr/bin/python2 -> python2.7
-rwxr-xr-x  1 root root  2655776 сент. 27 02:42 /usr/bin/python2.7
lrwxrwxrwx  1 root root        9 февр.  8 19:20 /usr/bin/python3 -> python3.2
lrwxrwxrwx  1 root root       11 февр.  8 19:20 /usr/bin/python3.2 -> python3.2mu
-rwxr-xr-x  1 root root  2863832 окт.  20 00:11 /usr/bin/python3.2mu
lrwxrwxrwx  1 root root       11 февр.  8 19:20 /usr/bin/python3mu -> python3.2mu
drwxrwsr-x  4 root staff    4096 окт.  17 18:59 /usr/local/lib/python2.7
drwxrwsr-x  3 root staff    4096 окт.  17 18:56 /usr/local/lib/python3.2
drwxr-xr-x 34 root root     4096 февр.  8 21:35 /usr/local/lib/python3.3
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Re: python related error reports

Postby xenopeek on Mon Feb 11, 2013 3:39 pm

Okay so this is weird, you have the library files for Python 3.3 but no executables. Only Python 3.2... The plot thickens! :D

Might be that you didn't install all the needed packages. Can you check with:
Code: Select all
dpkg -l | grep $'python3\.'

For only Python 3.2 installed, it shows the packages
Code: Select all
ii  libpython3.2                                3.2.3-6ubuntu3.1                          amd64        Shared Python runtime library (version 3.2)
ii  python3.2                                   3.2.3-6ubuntu3.1                          amd64        Interactive high-level object-oriented language (version 3.2)
ii  python3.2-minimal                           3.2.3-6ubuntu3.1                          amd64        Minimal subset of the Python language (version 3.2)

For Python 3.3 you should have each of these packages also. Perhaps you installed Python 3.3 from Synaptic? That by default doesn't install the package's recommended other packages, while apt-get and Software Manager both do this. So if you used Synaptic, you should be aware that most of the time you are crippling yourself. It may still have another cause though :D Let's see which python3 packages you have.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14660
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: python related error reports

Postby agvares on Mon Feb 11, 2013 3:57 pm

xenopeek wrote:Let's see which python3 packages you have


seems you were right:

Code: Select all
ii  libpython3.2                                                3.2.3-6ubuntu3.1                          amd64        Shared Python runtime library (version 3.2)
ii  python3.2                                                   3.2.3-6ubuntu3.1                          amd64        Interactive high-level object-oriented language (version 3.2)
ii  python3.2-minimal                                           3.2.3-6ubuntu3.1                          amd64        Minimal subset of the Python language (version 3.2)


but i really don't remember which method i've used to install python3.3
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Re: python related error reports

Postby xenopeek on Mon Feb 11, 2013 4:03 pm

Okay, let's check. What does this give:
Code: Select all
dpkg -S python3.3
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14660
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: python related error reports

Postby agvares on Mon Feb 11, 2013 4:09 pm

xenopeek wrote:Okay, let's check. What does this give:
Code: Select all
dpkg -S python3.3


it gives me:

Code: Select all
dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 38948 package 'pdfstudio':
 mo description
libobasis4.0-pyuno: /opt/libreoffice4.0/program/libpython3.3m.so


moreover, i've reinstalled python3 using apt-get, and now I don't see any message at all after entering non-existent commands, which kinda worries me a bit
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Re: python related error reports

Postby agvares on Mon Feb 11, 2013 4:32 pm

i've just learned an important lesson:

Code: Select all
apt-get remove python3


may destroy my system, and it did destroy it.

going for reinstall, I suppose.

any insights on how that could happen?
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Re: python related error reports

Postby xenopeek on Mon Feb 11, 2013 5:18 pm

Lots of system tools use Python 3 or Python 2.7, which is why I always think please don't touch Python as you will get yourself in trouble :| But you can safely install Python 3.3 alongside these other versions if you need 3.3. At least I have confirmed that the following command will install it properly and not cause the issues you described:
Code: Select all
apt install python3.3 libpython3.3

Now, if you want to make a Python 3.3 script you just start it with:
Code: Select all
#!/usr/bin/env python3.3

Do not try to make Python 3.3 your default Python or Python 3 interpreter, or you will get yourself in trouble again. Leave the default Python interpreters be, as those are needed by system software...
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14660
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: python related error reports

Postby agvares on Mon Feb 11, 2013 5:21 pm

xenopeek wrote:don't touch Python as you will get yourself in trouble


i'll remember that for sure

thanks for help

ps. i didn't quite get what you've said about Synaptics.

doesn't it install all the required packages as well? it sure seems like it's doing so whenever I try to install or remove anything.
agvares
Level 2
Level 2
 
Posts: 75
Joined: Sat Feb 25, 2012 5:22 pm

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: inderdhir, mattfaria12, mintoreo, petri0 and 32 guests