# -*- coding: utf-8 -*- GlobalPVersion='0.7' import _winreg,os,os.path,sys,time,string,urllib2 try: name, ponxdir, typ = _winreg.EnumValue(_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\CLSID\{EC501258-201C-449C-BE20-837A316EA382}\PythonCOMPath'), 0) ponxdir+='\\' except: ponxdir='C:\\ponx\\' os.mkdir(ponxdir[:-1]) #-------------------- pour TEST -------------------- #ponxdir="C:\\pluie\\" os.chdir(ponxdir) dircourant=os.getcwd() print print'Le répertoire de PONX est : ',ponxdir print'Le répertoire courant est : ',dircourant if dircourant.upper()!=ponxdir[:-1].upper(): print"Le répertoire PONX, et le répertoire courant sont différents." print"La mise à jour est abandonnée." sys.exit(1) def rfileweb(adr, repenregistrement='C:\\', fichier=None): if not repenregistrement.endswith('\\'): repenregistrement+='\\' page = urllib2.urlopen(adr).read() list = string.split(adr,'/') if fichier==None: nomlocal=list[-1] else: nomlocal=fichier print nomlocal if repenregistrement.startswith('.\\'): repenregistrement=repenregistrement[2:] if not os.path.isdir(os.getcwd()+'\\'+repenregistrement[:-1]) and repenregistrement!='': os.mkdir(os.getcwd()+'\\'+repenregistrement) f = open(repenregistrement+nomlocal, "wb") f.write(page) f.close() return('\r\nFile \t'+repenregistrement+nomlocal+'\r\n from \t'+adr) rfileweb('http://ponx.org/download/pluie.py','.\\') rfileweb('http://ponx.org/download/pluiefinstall.bat','.\\') rfileweb('http://ponx.org/download/pluie_reg.py','.\\') rfileweb('http://ponx.org/download/zipmci.py','.\\') rfileweb('http://ponx.org/download/pluimg.zip','.\\') rfileweb('http://ponx.org/download/include.zip','.\\') rfileweb('http://ponx.org/download/pluie_exemples.zip','.\\') os.system('pluiefinstall.bat') os.system('pluie_reg.py')