Seite 1 von 1

Python fehler bei versch. Anwendungen...

Verfasst: Montag 10. April 2006, 08:30
von lightmans2
Hallo Freunde,
ich habe Python 2.4.3 installiert (selbst kompiliert und installiert) auf ein Linux Ubuntu 5.10 Breezy Gnome Destop PC.
Seit dem habe ich immer die gleiche FM und ich habe leider absolut keine Ahnung von Python und weiss leider nicht wo ich genau nach dem Fehler suchen soll. Ich vermute das mit entweder ein Paket fehlt oder es ist ein Fehler in der __init__.py ... Keine Ahnung :)

Hier erst mal der Fehler den ich bekomme, wenn ich zb. Wifi-radar oder msncp (Console Messenger) starte:

===============================================

Code: Alles auswählen

root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# ./msncp 
Traceback (most recent call last): 
  File "./msncp", line 30, in ? 
    import curses       # Python 1.6 
  File "/usr/local/lib/python2.4/curses/__init__.py", line 15, in ? 
    from _curses import * 
ImportError: No module named _curses 
root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# wifi-radar 
Traceback (most recent call last): 
  File "/usr/sbin/wifi-radar", line 1795, in ? 
    import gtk, gobject 
  File "/usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 33, in ? 
    import gobject as _gobject 
ImportError: /usr/local/lib/python2.4/site-packages/gtk-2.0/gobject.so: undefined symbol: PyUnicodeUCS2_FromUnicode 
root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# 
===============================================

Und hier die __init__.py Datei:

===============================================

Code: Alles auswählen

root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# cat /usr/local/lib/python2.4/curses/__init__.py 
"""curses 

The main package for curses support for Python.  Normally used by importing 
the package, and perhaps a particular module inside it. 

   import curses 
   from curses import textpad 
   curses.initwin() 
   ... 

""" 

__revision__ = "$Id: __init__.py,v 1.5 2004/07/18 06:14:41 tim_one Exp $" 

from _curses import * 
from curses.wrapper import wrapper 

# Some constants, most notably the ACS_* ones, are only added to the C 
# _curses module's dictionary after initscr() is called.  (Some 
# versions of SGI's curses don't define values for those constants 
# until initscr() has been called.)  This wrapper function calls the 
# underlying C initscr(), and then copies the constants from the 
# _curses module to the curses package's dictionary.  Don't do 'from 
# curses import *' if you'll be needing the ACS_* constants. 

def initscr(): 
    import _curses, curses 
    stdscr = _curses.initscr() 
    for key, value in _curses.__dict__.items(): 
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'): 
            setattr(curses, key, value) 

    return stdscr 

# This is a similar wrapper for start_color(), which adds the COLORS and 
# COLOR_PAIRS variables which are only available after start_color() is 
# called. 

def start_color(): 
    import _curses, curses 
    retval = _curses.start_color() 
    if hasattr(_curses, 'COLORS'): 
        curses.COLORS = _curses.COLORS 
    if hasattr(_curses, 'COLOR_PAIRS'): 
        curses.COLOR_PAIRS = _curses.COLOR_PAIRS 
    return retval 

# Import Python has_key() implementation if _curses doesn't contain has_key() 

try: 
    has_key 
except NameError: 
    from has_key import has_key 




Code:

        except TypeError, e: 
            msg = str(e).replace(self.name, self.oldname) 
            raise TypeError(msg) 

class _DeprecatedConstant: 
    def __init__(self, value, name, suggestion): 
        self._v = value 
        self._name = name 
        self._suggestion = suggestion 

    def _deprecated(self, value): 
        message = '%s is deprecated, use %s instead' % (self._name, 
                                                        self._suggestion) 
        _warn(message, DeprecationWarning, 3) 
        return value 

    __nonzero__ = lambda self: self._deprecated(self._v == True) 
    __int__     = lambda self: self._deprecated(int(self._v)) 
    __str__     = lambda self: self._deprecated(str(self._v)) 
    __repr__    = lambda self: self._deprecated(repr(self._v)) 
    __cmp__     = lambda self, other: self._deprecated(cmp(self._v, other)) 

# _gobject deprecation 
class _GObjectWrapper(_module): 
    _gobject = _gobject 
    def __getattr__(self, attr): 
        _warn('gtk._gobject is deprecated, use gobject directly instead', 
              DeprecationWarning, 2) 
        return getattr(self._gobject, attr) 

# old names compatibility ... 
idle_add       = _Deprecated(_gobject.idle_add, 'idle_add', 'gobject') 
idle_remove    = _Deprecated(_gobject.source_remove, 'idle_remove', 'gobject') 
timeout_add    = _Deprecated(_gobject.timeout_add, 'timeout_add', 'gobject') 
timeout_remove = _Deprecated(_gobject.source_remove, 'timeout_remove', 'gobject') 
input_add      = _Deprecated(_gobject.io_add_watch, 'input_add', 'gobject') 
input_add_full = _Deprecated(_gobject.io_add_watch, 'input_add_full', 'gobject') 
input_remove   = _Deprecated(_gobject.source_remove, 'input_remove', 'gobject') 

mainloop                 = _Deprecated(main, 'mainloop') 
mainquit                 = _Deprecated(main_quit, 'mainquit') 
mainiteration            = _Deprecated(main_iteration, 'mainiteration') 
load_font                = _Deprecated(gdk.Font, 'load_font', 'gtk.gdk') 
load_fontset             = _Deprecated(gdk.fontset_load, 'load_fontset', 'gtk.gdk') 
create_pixmap            = _Deprecated(gdk.Pixmap, 'create_pixmap', 'gtk.gdk') 
create_pixmap_from_xpm   = _Deprecated(gdk.pixmap_create_from_xpm, 
                                       'pixmap_create_from_xpm', 'gtk.gdk') 
create_pixmap_from_xpm_d = _Deprecated(gdk.pixmap_create_from_xpm_d, 
                                       'pixmap_create_from_xpm_d', 'gtk.gdk') 

TRUE = _DeprecatedConstant(True, 'gtk.TRUE', 'True') 
FALSE = _DeprecatedConstant(False, 'gtk.FALSE', 'False') 

_gobject = _GObjectWrapper('gtk._gobject') 

# Can't figure out how to deprecate gdk.Warning 
gdk.Warning = Warning 

del _Deprecated, _DeprecatedConstant, _GObjectWrapper, _module, 
root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# 
.py /usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__. 
# -*- Mode: Python; py-indent-offset: 4 -*- 
# pygtk - Python bindings for the GTK toolkit. 
# Copyright (C) 1998-2003  James Henstridge 
# 
#   gtk/__init__.py: initialisation file for gtk package. 
# 
# This library is free software; you can redistribute it and/or 
# modify it under the terms of the GNU Lesser General Public 
# License as published by the Free Software Foundation; either 
# version 2.1 of the License, or (at your option) any later version. 
# 
# This library is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
# Lesser General Public License for more details. 
# 
# You should have received a copy of the GNU Lesser General Public 
# License along with this library; if not, write to the Free Software 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
# USA 

from types import ModuleType as _module 
from warnings import warn as _warn 

# this can go when things are a little further along 
try: 
    import ltihooks, sys 
    sys.path.insert(1, 'gobject') 
    del ltihooks, sys 
except ImportError: 
    pass 

import gobject as _gobject 

# load the required modules: 
import sys 
sys_path = sys.path[:] 
from _gtk import * 

# init_gtk calls PySys_SetArgv which calls sys.path.insert(0, ''), 
# which causes problems for pychecker, restore it if modified. 
if sys.path != sys_path: 
    sys.path = sys_path 
del sys, sys_path 

import keysyms 
import gdk # this is created by the _gtk import 

threads_init = gdk.threads_init 
threads_enter = gdk.threads_enter 
threads_leave = gdk.threads_leave 

gdk.INPUT_READ      = _gobject.IO_IN | _gobject.IO_HUP | _gobject.IO_ERR 
gdk.INPUT_WRITE     = _gobject.IO_OUT | _gobject.IO_HUP 
gdk.INPUT_EXCEPTION = _gobject.IO_PRI 

# other deprecated symbols 
class _Deprecated: 
    def __init__(self, func, oldname, module=''): 
        self.func = func 
        self.oldname = oldname 
        self.name = func.__name__ 
        if module: 
            self.module = module 
        else: 
            self.module = 'gtk' 

    def __repr__(self): 
        return '<deprecated function %s>' % (self.oldname) 

    def __call__(self, *args, **kwargs): 
        oldname = 'gtk.' + self.oldname 
        newname = self.module + '.' + self.name 
        message = '%s is deprecated, use %s instead' % (oldname, newname) 
        # DeprecationWarning is imported from _gtk, so it's not the same 
        # as the one found in exceptions. 
        _warn(message, DeprecationWarning, 2) 
        try: 
            return self.func(*args, **kwargs) 
        except TypeError, e: 
            msg = str(e).replace(self.name, self.oldname) 
            raise TypeError(msg) 

class _DeprecatedConstant: 
    def __init__(self, value, name, suggestion): 
        self._v = value 
        self._name = name 
        self._suggestion = suggestion 

    def _deprecated(self, value): 
        message = '%s is deprecated, use %s instead' % (self._name, 
                                                        self._suggestion) 
        _warn(message, DeprecationWarning, 3) 
        return value 

    __nonzero__ = lambda self: self._deprecated(self._v == True) 
    __int__     = lambda self: self._deprecated(int(self._v)) 
    __str__     = lambda self: self._deprecated(str(self._v)) 
    __repr__    = lambda self: self._deprecated(repr(self._v)) 
    __cmp__     = lambda self, other: self._deprecated(cmp(self._v, other)) 

# _gobject deprecation 
class _GObjectWrapper(_module): 
    _gobject = _gobject 
    def __getattr__(self, attr): 
        _warn('gtk._gobject is deprecated, use gobject directly instead', 
              DeprecationWarning, 2) 
        return getattr(self._gobject, attr) 

# old names compatibility ... 
idle_add       = _Deprecated(_gobject.idle_add, 'idle_add', 'gobject') 
idle_remove    = _Deprecated(_gobject.source_remove, 'idle_remove', 'gobject') 
timeout_add    = _Deprecated(_gobject.timeout_add, 'timeout_add', 'gobject') 
timeout_remove = _Deprecated(_gobject.source_remove, 'timeout_remove', 'gobject') 
input_add      = _Deprecated(_gobject.io_add_watch, 'input_add', 'gobject') 
input_add_full = _Deprecated(_gobject.io_add_watch, 'input_add_full', 'gobject') 
input_remove   = _Deprecated(_gobject.source_remove, 'input_remove', 'gobject') 

mainloop                 = _Deprecated(main, 'mainloop') 
mainquit                 = _Deprecated(main_quit, 'mainquit') 
mainiteration            = _Deprecated(main_iteration, 'mainiteration') 
load_font                = _Deprecated(gdk.Font, 'load_font', 'gtk.gdk') 
load_fontset             = _Deprecated(gdk.fontset_load, 'load_fontset', 'gtk.gdk') 
create_pixmap            = _Deprecated(gdk.Pixmap, 'create_pixmap', 'gtk.gdk') 
create_pixmap_from_xpm   = _Deprecated(gdk.pixmap_create_from_xpm, 
                                       'pixmap_create_from_xpm', 'gtk.gdk') 
create_pixmap_from_xpm_d = _Deprecated(gdk.pixmap_create_from_xpm_d, 
                                       'pixmap_create_from_xpm_d', 'gtk.gdk') 

TRUE = _DeprecatedConstant(True, 'gtk.TRUE', 'True') 
FALSE = _DeprecatedConstant(False, 'gtk.FALSE', 'False') 

_gobject = _GObjectWrapper('gtk._gobject') 

# Can't figure out how to deprecate gdk.Warning 
gdk.Warning = Warning 

del _Deprecated, _DeprecatedConstant, _GObjectWrapper, _module, 
root@lightmans2:/home/harald/Downloads/msncp-0.5.0-beta# 
Ich hoffe ihr könnt was damit anfangen und könnt mir helfen :)
Danke euch im voraus und Grüsse,
Lightmans2

Verfasst: Montag 10. April 2006, 23:40
von Leonidas
Also meine Vermutungen:
  • Du hast Python kompiliert, ohne die libncurses(w)5-dev installiert zu haben, daher auch kein curses-Modul
  • kein PyGTK installiert, daher auch kein Zugriff auf GTK und GObject

Verfasst: Donnerstag 13. April 2006, 05:43
von lightmans2
Hi, ok ich will jetzt nochmal von vorne anfangen ... i
ch denke auch das es in das falsche verz. installiert wurde /usr/local/usw...
Normalerweise sollte es im verz. /usr/bin/python2.4 oder im /usr/lib/python2.4 sein...

Wie bekomme ich den meine Python 2.4.3 selbst kompilierte Version wieder deinstalliert? Nirgendswo finde ich dazu eine Anleitung oder ähnliches...

Gibt es irgendwo ein Howto wo erklärt wird wie man unter Debian/Ubuntu Python selbst installieren oder compilieren kann mit allen normalen notwendigen paketen??

Gruss
Lightmans

fehler gefunden...

Verfasst: Donnerstag 13. April 2006, 07:00
von lightmans2
Hi, ich habe nun alles was Python angeht kompl. deinstalliert und alles neu installiert und compiliert... und ich glaube ich habe den fehler gefunden aber ich weiss nicht wie ich ihn korregiere...

Wenn ich make install ausführe kommen diese fehler bei den _cursesmodule.c

Code: Alles auswählen

/root/Python-2.4.3/Modules/_cursesmodule.c:2516: error: `A_BOLD' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2517: error: `A_ALTCHARSET' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2519: error: `A_INVIS' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2521: error: `A_PROTECT' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2522: error: `A_CHARTEXT' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2523: error: `A_COLOR' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2545: error: `COLOR_BLACK' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2546: error: `COLOR_RED' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2547: error: `COLOR_GREEN' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2548: error: `COLOR_YELLOW' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2549: error: `COLOR_BLUE' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2550: error: `COLOR_MAGENTA' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2551: error: `COLOR_CYAN' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2552: error: `COLOR_WHITE' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2593: error: `KEY_MIN' undeclared (first use in this function)
/root/Python-2.4.3/Modules/_cursesmodule.c:2593: error: `KEY_MAX' undeclared (first use in this function)
kann jemand was damit anfangen? und weiss zufällig jemand woran das liegt?

Gruss
Lightmans

Verfasst: Donnerstag 13. April 2006, 07:51
von Rebecca
Ist den die (n)curses-Bibliothek bei dir installiert? Also hast du in /usr/lib sowas wie libncurses.so etc? Und sind die entsprechenden include-Dateien vorhanden (/usr/include/curses.h etc)? Ohne die geht's naemlich nicht.

Bei Suse braeuchte man die Pakete ncurses und ncurses-devel. Wie die bei Ubuntu heissen, weiss ich allerdings nicht.

Verfasst: Donnerstag 13. April 2006, 09:36
von Leonidas
lightmans2 hat geschrieben:Wie bekomme ich den meine Python 2.4.3 selbst kompilierte Version wieder deinstalliert? Nirgendswo finde ich dazu eine Anleitung oder ähnliches...
Manchmal gibt es eine uninstall-Rule im Makefile, aber oft muss man die Dateien per hand suchen und per Hand suchen. Deswegen gibt es das tolle Programm Checkinstall, das bei der Installation schaut wo sich ein Programm vergräbt und dann ein Paket schnürt, welches man nachher mit dem Paketmanagement wieder deinstallieren kann (RPM, DEB).
Das ist auch ein Grund, warum ich wenn ich Python aus den Sourcen kompiliere immer Backporte: danach ist es sauber installiert, alle Module sind da und ich kanns auch wieder deinstallieren und wenn ich das System update wird dann auch die Python-Installation aktualisiert.
Rebecca hat geschrieben:Bei Suse braeuchte man die Pakete ncurses und ncurses-devel. Wie die bei Ubuntu heissen, weiss ich allerdings nicht.
Ich habe schon geschrieben, dass das Paket bei Debian und auch Ubuntu libncurses5-dev bzw. libncursesw5-dev (mit Unterstützung für "wide characters").