[PythonCE] ~Name not defined" error

taraiti taraiti at gmail.com
Fri Jul 11 10:22:18 CEST 2008


Hi,

I have just installed PythonCE from SourceForge on a Windows Mobile 5.0 ARM
PDA (HTC P3600).  When I enter in the interpreter window

import _winreg
help(_winreg)

I get a print out of the appropriate help.

When I run this script by double clicking its file

from _winreg import *

print r"*** Reading from SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***"
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)

aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
for i in range(1024):                                          
    try:
        n,v,t = EnumValue(aKey,i)
        print i, n, v, t
    except EnvironmentError:                                              
        print "You have",i," tasks starting at logon..."
        break         
CloseKey(aKey)                                                 

print r"*** Writing to SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***"
aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 0,
KEY_WRITE)
try:  
   SetValueEx(aKey,"MyNewKey",0, REG_SZ, r"c:\winnt\explorer.exe")
except EnvironmentError:                                         
    print "Encountered problems writing into the Registry..."
CloseKey(aKey)

CloseKey(aReg)

it prints the first line correctly but then prints

Name Error: name 'ConnectRegistry' is not defined

Can anyone suggest what the problem is please?

Regards

David Williams
-- 
View this message in context: http://www.nabble.com/%7EName-not-defined%22-error-tp18398957p18398957.html
Sent from the Python - pythonce mailing list archive at Nabble.com.



More information about the PythonCE mailing list