Sunday, 15 January 2012

Cygwin Python Script using cygwinreg that can run on the Windows Python -



Cygwin Python Script using cygwinreg that can run on the Windows Python -

python newbie here.

i writing simple script in python, using 2.7.3 distribution cygwin. want access/modify windows registry script. found out _winreg module not available on cygwin python alternative cygwinreg exists.

the users of script not have cygwin python, have windows python install. possible write python script work on both?

sure, this:

try: import _winreg except importerror: import cygwinreg _winreg

or maybe

import sys if sys.platform == 'win32': import _winreg elif sys.platform == 'cygwin': import cygwinreg _winreg else: # non-windows back upwards

python cygwin winreg

No comments:

Post a Comment