Works only in interactive mode

qwweeeit at yahoo.it qwweeeit at yahoo.it
Mon Oct 10 17:15:17 EDT 2005


Hi all,
using Python 2.4 under Linux (SUSE 9.3) I was developping a script to
get various lists related with DCOP.
In interactive Python all is working correctly:

import pcop

# application's registration with DCOP
x=pcop.register_as('kate')
print x
    kate-7497

# list of DCOP registered applications
print pcop.app_list('kate')
    ['kwin', 'kicker', 'konqueror-7203', 'kate', 'kded', 'kmix',
'kate-7497',       'knotify', 'susewatcher', 'suseplugger',
'kio_uiserver', 'kcookiejar', 'klauncher', 'khotkeys', 'kdesktop',
'konsole-7340', 'klipper', 'ksmserver', 'kaccess', 'kpowersave']

Instead as a script:

1 import pcop
2
3 # application's registration with DCOP
4 x=pcop.register_as('kate')
5 print x
6
7 # list of DCOP registered applications (emula dcop)
8 print pcop.app_list('kate')

you get:
0
Traceback (most recent call last):
  File "/home/bf/python/pippo.py", line 4, in ?
    x=pcop.register_as('kate')
AttributeError: 'module' object has no attribute 'register_as'

How is it possible?
Bye.




More information about the Python-list mailing list