Detect PythonWin?

Andrew Dalke adalke at mindspring.com
Fri Aug 1 04:59:21 EDT 2003


Martin Bless wants to know how to do:
> if detect("running on PythonWin"):
>     pass
>     # fake arguments ...
> else:
>     "proceed normal"

To see if you're on Windows,

>>> import sys
>>> sys.platform
'win32'
>>>

To see if the win32 extensions are installed

try:
  import win32com  # or another module in the extension
except ImportError:
  print "Not installed"
else:
  print "Installed!"

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list