announcement

Uwe Schmitt uwe.schmitt at procoders.net
Mon Jul 29 04:39:41 EDT 2002


Gerhard Häring <gerhard.haering at gmx.de> wrote:
| Uwe Schmitt wrote in comp.lang.python:

| One correction for rnetgui.py:

| try:
|     from win32api import RegOpenKeyEx, RegQueryValueEx, error
|     from win32con import HKEY_LOCAL_MACHINE, KEY_READ
|     key = RegOpenKeyEx(HKEY_LOCAL_MACHINE,r'SOFTWARE\Ziarc',0,KEY_READ)
|     homepath=RegQueryValueEx(key,'Path')[0]
| #except error:
| except Exception, reason:
|     homepath=os.path.abspath(".")

| I replaced the "except error:" line to get it running on Linux.

Thanks, I missed to check if the lates version runs on linux.
The code after try makes only sense for the soon following
ziarc windows installer.

| You might want to do a

| try:
|     from win32api import ...
| except ImportError:
|     # ...

| to check wether the win32 extensions are available, which on
| non-Windows system, they usually aren't ;-)

the import statemente is not the only statement which might rise
an exception, the line begining with "homepath=" might cause
an exception too.

Greetings, Uwe.
-- 
Dr. rer. nat. Uwe Schmitt    python, php, c++, codes, tips, tutorials at
uwe.schmitt at procoders.net    http://www.procoders.net



More information about the Python-list mailing list