Bug 2935 - name 'clawsmail' is not defined
Summary: name 'clawsmail' is not defined
Status: NEW
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: Plugins/Python (show other bugs)
Version: 3.9.1
Hardware: PC Linux
: P3 minor
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2013-06-04 21:19 CEST by cra7yh0rse
Modified: 2013-06-13 08:03 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cra7yh0rse 2013-06-04 21:19:06 CEST
Opening the python shell and trying to type in "help(clawsmail)" will cause a "NameError: global name 'clawsmail' is not defined"

Even if trying some scripting in ~/.claws-mail/python-scripts/ and launching claws-mail from the console, it will report:

=====================================================
RuntimeError: could not find _PyGtk_API object
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'clawsmail' is not defined
Traceback (most recent call last):
  File "/home/?????/.claws-mail/python-scripts/auto/startup", line 92, in <module>
    add_python_documentation_menu_item()
  File "/home/????/.claws-mail/python-scripts/auto/startup", line 29, in add_python_documentation_menu_item
    group = clawsmail.get_mainwindow_action_group()
NameError: global name 'clawsmail' is not defined
Traceback (most recent call last):
  File "/home/????/.claws-mail/python-scripts/auto/shutdown", line 8, in <module>
    if not clawsmail.is_exiting():
NameError: name 'clawsmail' is not defined
=====================================================

Maybe I miss PyGtk_API, but I doubt it.

B. Regards

Crazy Horse
Comment 1 Holger Berndt 2013-06-04 22:08:22 CEST
Does starting Claws Mail with --debug reveal anything useful?
Comment 2 cra7yh0rse 2013-06-05 11:33:19 CEST
Starting with --debug
======================================================================
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/python.so'
plugin.c:370:plugin licence check passed: GPL3+ found
hooks.c:71:registed new hook for 'compose_created' as id 1

** (claws-mail:12839): WARNING **: Trying to register gtype 'GtkCMUnit' as enum when in fact it is of type 'gint'
RuntimeError: could not find _PyGtk_API object
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'clawsmail' is not defined
python_plugin.c:407:Refreshing: /home/?????/.claws-mail/python-scripts/main
python_plugin.c:407:Refreshing: /home/????/.claws-mail/python-scripts/compose
python_plugin.c:575:Python plugin loaded
======================================================================

That's the _only_ relevant error during the open session.
Opened the python shell and typed "help(clawsmail)" usual traceback error from python.

BTW I'm running Archlinux up-to-date.
It seems to me that some wrong typing has gone for the root name,
Maybe I should see with the author of the python plugin.
Comment 3 Ricardo Mones 2013-06-06 09:42:59 CEST
Based on previous similar bugs on Archlinux¹², seems there's some rebuild required to cope with a new python/python-gtk version. 

But since I don't use it I may be wrong :)

¹https://bugs.archlinux.org/task/21207
²https://bugs.archlinux.org/task/21459
Comment 4 Holger Berndt 2013-06-07 00:41:42 CEST
Could very well be. I can't reproduce it here, and currently don't have another idea what could be wrong. That's also due to poor error handling and reporting on the plugin side.. I'll see if I can at least improve that part, to make debugging easier in the future.
Comment 5 cra7yh0rse 2013-06-07 03:55:15 CEST
You may spend a bit of time by setting up a virtualbox with archlinux and claws-mail, if you like.
The Vbox it could be found at http://sourceforge.net/projects/virtualboximage/files/Archlinux/2011.08.19/Archlinux-2011.08.19-i686_xorg.7z.
Then you should try an upgrade by issuing in a terminal as root.
======================================================================
# pacman -Syu
======================================================================

Availability time permitting :-).
However it's a minor bug. We may survive with it ;-)
Thanks to report me the bug report on archlinux site. I'll take a look also at that one.

BTW my is an Arch64.
Comment 6 cra7yh0rse 2013-06-11 18:52:47 CEST
SOLVED !!!
You may think that's crazy :-) but it is really the most logic solution
====================================================================
>>> import clawsmail
>>> clawsmail
<module 'clawsmail' (built-in)>
>>> help(clawsmail)
Help on module clawsmail:

NAME
    clawsmail

FILE
    (built-in)
.............. 8<  8<
====================================================================
my version is
$ claws-mail -v
Claws Mail version 3.9.2

Now I got so much to chew :-P
Comment 7 cra7yh0rse 2013-06-11 18:54:58 CEST
BTW, it should need to correct the documentations in this regard
Comment 8 Holger Berndt 2013-06-11 22:22:56 CEST
No, the import should be automatic, and if it isn't, something is fishy. The documentation is correct as it is.
Comment 9 cra7yh0rse 2013-06-13 08:03:04 CEST
You're right.
For some reason if I try a python command like
clawsmail.get_folder_tree()
Then it will kill clawsmail in less than a minute.
Here the shell output while trying the above python shell command:
===================================================================
msgcache.c:1258:TIMING msgcache_write : 0s000ms
inc.c:1527:added timer = 139
prefs.c:297:Found [Plugins_GTK2]
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/archive.so'
plugin.c:370:plugin licence check passed: GPL3+ found
prefs_gtk.c:86:Reading configuration...
archiver.c:76:archive plugin loaded
plugin.c:525:Plugin Archivia mail (from file /usr/lib/claws-mail/plugins/archive.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/archive.so: 0s008ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/mailmbox.so'
plugin.c:370:plugin licence check passed: GPL3+ found
folder.c:124:registering folder class mailmbox
plugin.c:525:Plugin mailmbox folder (etPan!) (from file /usr/lib/claws-mail/plugins/mailmbox.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/mailmbox.so: 0s002ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/notification.so'
plugin.c:370:plugin licence check passed: GPL3+ found
hooks.c:71:registed new hook for 'folder_item_update' as id 4
hooks.c:71:registed new hook for 'folder_update' as id 4
hooks.c:71:registed new hook for 'msginfo_update' as id 3
hooks.c:71:registed new hook for 'offline_switch' as id 1
hooks.c:71:registed new hook for 'mainwindow_close' as id 1
hooks.c:71:registed new hook for 'mainwindow_iconified' as id 1
hooks.c:71:registed new hook for 'account_list_changed' as id 1
hooks.c:71:registed new hook for 'theme_changed' as id 1
prefs_gtk.c:86:Reading configuration...
notification_core.c:328:Notification Plugin: Hash table created
notification_hotkeys.c:105:Notification plugin: Updating keybindings..
notification_hotkeys.c:115:Notification plugin: Unbinding all keybindings..
notification_hotkeys.c:105:Notification plugin: Updating keybindings..
notification_hotkeys.c:115:Notification plugin: Unbinding all keybindings..
notification_plugin.c:354:Notification plugin loaded
plugin.c:525:Plugin Notifica (from file /usr/lib/claws-mail/plugins/notification.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/notification.so: 0s015ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/pgpcore.so'
plugin.c:370:plugin licence check passed: GPL3+ found
sgpgme.c:623:setting gpgme CTYPE locale
sgpgme.c:629:setting gpgme locale to: it_IT.UTF-8
sgpgme.c:636:setting gpgme locale to UTF8: it_IT.UTF-8
sgpgme.c:639:done
sgpgme.c:644:setting gpgme MESSAGES locale
sgpgme.c:650:setting gpgme locale to: it_IT.UTF-8
sgpgme.c:656:setting gpgme locale to UTF8: it_IT.UTF-8
sgpgme.c:660:done
sgpgme.c:666:GpgME Protocol: OpenPGP
Version: 2.0.20 (req 1.4.0)
Executable: /usr/bin/gpg
sgpgme.c:666:GpgME Protocol: CMS
Version: 2.0.20 (req 1.9.6)
Executable: /usr/bin/gpgsm
sgpgme.c:666:GpgME Protocol: GPGCONF
Version: 2.0.20 (req 2.0.4)
Executable: /usr/bin/gpgconf
sgpgme.c:666:GpgME Protocol: Assuan
Version: 1.0 (req 1.0)
Executable: /tmp/gpg-szkDUG/S.gpg-agent
sgpgme.c:666:GpgME Protocol: UIServer
Version: 1.0 (req 1.0)
Executable: /home/user/.gnupg/S.uiserver
prefs_gtk.c:86:Reading configuration...
prefs_gpg.c:530:set GPG_AGENT_INFO=/tmp/gpg-szkDUG/S.gpg-agent:1490:1
prefs_gpg.c:438:Saving GPG config
prefs.c:310:Found [GPG]
plugin.c:525:Plugin PGP/Core (from file /usr/lib/claws-mail/plugins/pgpcore.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/pgpcore.so: 0s082ms
plugin.c:273:adding /usr/lib/claws-mail/plugins/pgpmime.so to /usr/lib/claws-mail/plugins/pgpcore.so rdeps
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/pgpmime.so'
plugin.c:370:plugin licence check passed: GPL3+ found
plugin.c:525:Plugin PGP/MIME (from file /usr/lib/claws-mail/plugins/pgpmime.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/pgpmime.so: 0s004ms
plugin.c:273:adding /usr/lib/claws-mail/plugins/smime.so to /usr/lib/claws-mail/plugins/pgpcore.so rdeps
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/smime.so'
plugin.c:370:plugin licence check passed: GPL3+ found
plugin.c:525:Plugin S/MIME (from file /usr/lib/claws-mail/plugins/smime.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/smime.so: 0s004ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/pdf_viewer.so'
plugin.c:370:plugin licence check passed: GPL3+ found
plugin.c:525:Plugin Visualizzatore PDF (from file /usr/lib/claws-mail/plugins/pdf_viewer.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/pdf_viewer.so: 0s026ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/python.so'
plugin.c:370:plugin licence check passed: GPL3+ found
hooks.c:71:registed new hook for 'compose_created' as id 1

** (claws-mail:3174): WARNING **: Trying to register gtype 'GtkCMUnit' as enum when in fact it is of type 'gint'
RuntimeError: could not find _PyGtk_API object
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'clawsmail' is not defined
python_plugin.c:407:Refreshing: /home/????/.claws-mail/python-scripts/main
python_plugin.c:407:Refreshing: /home/????/.claws-mail/python-scripts/compose
python_plugin.c:575:Python plugin loaded
plugin.c:525:Plugin Python (from file /usr/lib/claws-mail/plugins/python.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/python.so: 0s067ms
plugin.c:451:trying to load `/usr/lib/claws-mail/plugins/address_keeper.so'
plugin.c:370:plugin licence check passed: GPL3+ found
hooks.c:71:registed new hook for 'compose_check_before_send' as id 1
prefs_gtk.c:86:Reading configuration...
prefs_gtk.c:1103:no 'AddressKeeper' section in '/home/????/.claws-mail/clawsrc' cache
address_keeper.c:260:Address Keeper plugin loaded
plugin.c:525:Plugin Address Keeper (from file /usr/lib/claws-mail/plugins/address_keeper.so) loaded
plugin.c:526:TIMING plugin_load /usr/lib/claws-mail/plugins/address_keeper.so: 0s002ms
prefs_gtk.c:1074:destroying cache
main.c:1719:TIMING main startup: 5s170ms
claws.c:102:Starting Claws Mail version Claws Mail 3.9.2
utils.c:1874:using default rc_dir /home/????/.claws-mail
main.c:2336:Using control socket /tmp/claws-mail-1000/58c107d390fa69c187b12327b2ba0270
main.c:2430:another Claws Mail instance is already running.

** (process:3222): WARNING **: Socket IO timeout


** (process:3222): WARNING **: [13:52:03] Socket IO timeout.

Claws Mail is already running on display .
==========================================================================