LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Python Error is SLES (No module name readline) (https://www.linuxquestions.org/questions/linux-software-2/python-error-is-sles-no-module-name-readline-773662/)

fear_matrix 12-05-2009 09:58 AM

Python Error is SLES (No module name readline)
 
Guys i have really lost my patience and now i want help from you guys . I recently installed python in SLES and now i get the below error when running it. I have googled a lot for possible solution but no luck found. Please guys help me on this


Code:

    The GCC team.
Distribution: SUSE Linux Enterprise 11
linux-ooix:~/Desktop # python3
Python 3.1.1 (r311:74480, Dec  4 2009, 23:28:49)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in <module>
    import readline
ImportError: No module named readline

Regards
fear_matrix

jhwilliams 12-05-2009 12:17 PM

Quote:

Originally Posted by fear_matrix (Post 3780926)
Code:

File "/etc/pythonstart", line 7, in <module>
    import readline
ImportError: No module named readline


Wf is /etc/pythonstart? I don't have one. What does it say on and around line 7? import readline?

Note that python 3.1 code related to readline may be found in these files:
Code:

jameson@salmon:/usr/lib/python3.1$find . -name "*readline*"
./lib2to3/fixes/fix_xreadlines.py
./lib2to3/fixes/fix_xreadlines.pyc
./lib-dynload/readline.so

What do you see when you perform that find in your python dir?

fear_matrix 12-06-2009 01:14 AM

Quote:

Originally Posted by jhwilliams (Post 3781019)
Wf is /etc/pythonstart? I don't have one. What does it say on and around line 7? import readline?

Note that python 3.1 code related to readline may be found in these files:
Code:

jameson@salmon:/usr/lib/python3.1$find . -name "*readline*"
./lib2to3/fixes/fix_xreadlines.py
./lib2to3/fixes/fix_xreadlines.pyc
./lib-dynload/readline.so

What do you see when you perform that find in your python dir?


Well in line 7 it says Import Readline. Funny thing is that it works perfectly in Red Hat Linux Enterprise 5. This is really getting into my nerve

km0r3 12-06-2009 04:43 AM

Hi,

1) Temporarily add this line to your $HOME/.bashrc or $HOME/.profile:

Quote:

PYTHONPATH=$PYTHONPATH=/usr/lib/python3.1/lib-dynload/
export $PYTHONPATH
reset your shell and try to invoke python3.1

OR

2) Try to install first readline development headers (in Ubuntu called readline-dev; no idea how this is called, neither installed, in Suse) and then compiling Python 3.1 from source. [http://python.org]
This usually helps.


Hope this helps.

fear_matrix 12-07-2009 03:17 AM

Quote:

Originally Posted by km0r3 (Post 3781543)
Hi,

1) Temporarily add this line to your $HOME/.bashrc or $HOME/.profile:



reset your shell and try to invoke python3.1

OR

2) Try to install first readline development headers (in Ubuntu called readline-dev; no idea how this is called, neither installed, in Suse) and then compiling Python 3.1 from source. [http://python.org]
This usually helps.


Hope this helps.


Thanks for your help but the above solution did not resolved my issue. It seems that the readline module was missing in SLES 11 which is important for Python 3 to run stable. Anyways i have resolved this issue and i would like to share the solution with you guys :-

Solution

1 - I downloaded readline 5.2 from icewalkers website
2 - Installed readline 5.2 by compiling it from the source code
3 - Re-compiled Python 3 from the source code
4 - I executed python 3 and everything is working smoothly without any error.

Regards
Fear_Matrix


All times are GMT -5. The time now is 09:10 PM.