You are not logged in.

#1 2010-05-14 22:57:29

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

[SOLVED] error when execute a python script in home partition

Friends,

   After of install the Arch in my notebook (note: "/" and "/home" in separated partition) if I open a terminal/shell and try execute a python program/script in the /home partition I receive many erros and the program don't run:

 [leandro@professionalit ~]$ alacarte
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 22, in <module>
    from Alacarte.MainWindow import MainWindow
ImportError: No module named Alacarte.MainWindow
[leandro@professionalit ~]$ 
[leandro@professionalit ~]$ dropbox start
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/dropbox", line 26, in <module>
    import optparse
  File "/usr/lib/python2.6/optparse.py", line 75, in <module>
    import sys, os
  File "os.py", line 2, in <module>
    import socket
  File "/usr/lib/python2.6/socket.py", line 92, in <module>
    __all__.extend(os._get_exports_list(_socket))
AttributeError: 'module' object has no attribute '_get_exports_list'

But, if I go to another partition, for example, the folder opt in partition / (/opt) and try execute the program it run OK.

Any idea ?

Best regards,
Leandro.

Last edited by LeandroTiger (2010-05-21 23:02:29)

Offline

#2 2010-05-19 19:00:29

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

Friends,

  Any idea ?

-- Leandro.

Offline

#3 2010-05-20 00:52:40

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [SOLVED] error when execute a python script in home partition

Try reinstalling gnome-menus package.

Offline

#4 2010-05-20 01:05:20

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

without success.

Offline

#5 2010-05-20 01:21:39

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [SOLVED] error when execute a python script in home partition

Try running the program like:

 python /usr/bin/alacarte

Offline

#6 2010-05-20 03:08:04

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

[leandro@professionalit ~]$ cd ~
[leandro@professionalit ~]$ python /usr/bin/alacarte
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 22, in <module>
    from Alacarte.MainWindow import MainWindow
ImportError: No module named Alacarte.MainWindow
[leandro@professionalit ~]$
[leandro@professionalit ~]$ cd /usr/
[leandro@professionalit usr]$ python /usr/bin/alacarte
[leandro@professionalit usr]$ python /usr/bin/alacarte &
[1] 5923
[leandro@professionalit usr]$

Last edited by LeandroTiger (2010-05-20 03:09:01)

Offline

#7 2010-05-20 12:30:21

rransom
Member
Registered: 2010-04-26
Posts: 92

Re: [SOLVED] error when execute a python script in home partition

Try reinstalling Python.

Offline

#8 2010-05-20 16:46:06

Ekimino
Member
From: Maldonado, Uruguay
Registered: 2008-02-26
Posts: 69
Website

Re: [SOLVED] error when execute a python script in home partition

This is just intuiton I'm no programmer, but i think the traceback goes down to a python OS call for getting the exports lists, and that's enviroment variables, which could be the problem behind running it from different directories.

Maybe you've been messing around with those?



Cheers.

Last edited by Ekimino (2010-05-20 16:48:19)

Offline

#9 2010-05-21 21:40:11

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

rransom wrote:

Try reinstalling Python.

[leandro@professionalit opt]$ sudo pacman -S python
warning: python-2.6.5-3 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): python-2.6.5-3  

Total Download Size:    0.00 MB
Total Installed Size:   61.86 MB

Proceed with installation? [Y/n] y
checking package integrity...
(1/1) checking for file conflicts                   [#####################] 100%
(1/1) upgrading python                              [#####################] 100%

[leandro@professionalit ~]$ pwd
/home/leandro
[leandro@professionalit ~]$ alacarte
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 22, in <module>
    from Alacarte.MainWindow import MainWindow
ImportError: No module named Alacarte.MainWindow
[leandro@professionalit ~]$ cd /opt/
[leandro@professionalit opt]$ alacarte &
[1] 4095
[leandro@professionalit opt]$

Last edited by LeandroTiger (2010-05-21 21:40:47)

Offline

#10 2010-05-21 22:22:48

Blue Peppers
Member
From: Newbury, UK
Registered: 2009-02-01
Posts: 178

Re: [SOLVED] error when execute a python script in home partition

Open a python interactive shell in your home dir, by just executing python without any arguments. Could you post the output of the following:

import sys
print sys.path
import site
import Alacarte

The first line imports the sys module, which contains much infomation about python. The second outputs the sys.path variable, which is a list of all the folders that python searches when importing a module. The third line imports the site module, which isn't used much, but when you executed alacarte, it failed to import this module, raising an error, which was hidden. You should be able to see the error in the interactive shell. The last line imports the Alacarte core module, and is just a test to see if any third party modules are working.


Consistency is not a virtue.

Offline

#11 2010-05-21 22:30:29

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

[leandro@professionalit ~]$ pwd
/home/leandro
[leandro@professionalit ~]$ python
'import site' failed; use -v for traceback
Python 2.6.5 (r265:79063, Apr  1 2010, 05:22:20) 
[GCC 4.4.3 20100316 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '', '/usr/lib/openoffice/basis-link/program/', '/usr/lib/python26.zip', '/usr/lib/python2.6/', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload']
>>> import socket
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/socket.py", line 79, in <module>
    import os, sys, warnings
  File "os.py", line 10, in <module>
    from django.core.management import execute_manager
ImportError: No module named django.core.management
>>>

Last edited by LeandroTiger (2010-05-21 22:31:04)

Offline

#12 2010-05-21 22:33:05

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

[leandro@professionalit ~]$ pwd
/home/leandro
[leandro@professionalit ~]$ python
'import site' failed; use -v for traceback
Python 2.6.5 (r265:79063, Apr  1 2010, 05:22:20) 
[GCC 4.4.3 20100316 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '', '/usr/lib/openoffice/basis-link/program/', '/usr/lib/python26.zip', '/usr/lib/python2.6/', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload']
>>> import site
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site.py", line 62, in <module>
    import os
  File "os.py", line 2, in <module>
    import socket
  File "/usr/lib/python2.6/socket.py", line 92, in <module>
    __all__.extend(os._get_exports_list(_socket))
AttributeError: 'module' object has no attribute '_get_exports_list'
>>> import Alacarte
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Alacarte
>>>

Offline

#13 2010-05-21 23:01:16

LeandroTiger
Member
Registered: 2008-07-29
Posts: 12

Re: [SOLVED] error when execute a python script in home partition

Friends,

   That stupid I'm.
   I had a os.py in my home folder and this was the root cause of the problem.

  Thank you very much.

  best regards,
  Leandro.

Offline

Board footer

Powered by FluxBB