Bonjour à tous.
voila, j'ai fais un petit prog en python qui permet aux redacteur de la boite de retaillé une image au bon format avant de l'uploader sur le serveur (une redimention ou découpe automatique ne correspondant souvent pas à nos attente)
Afin d'éviter d'installé l'interpreteur sur chaque poste, je souhaite créer un .exe a partir de py2exe.
la "compilation" se passe, mon .exe généré, mais au lancement du .exe:
mon imaging.py:Citation:
imaging.exe a rencontré un problème et doit fermer. Nous vous prions de nous excuser pour le désagrément encouru.
mon setup.py:Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149 # -*- coding: utf-8 -*- import os from Tkinter import* import tkFileDialog import tkMessageBox from PIL import Image, ImageTk ############################ # Definition de variables: # ############################ x="vide" y="vide" x1="vide" y1="vide" x2="vide" y2="vide" etatboutonsouris="haut" myFormats = [ ('JPEG: Image JPEG/JPG','*.jpg *.jpeg'), ('BMP: Windows Bitmap','*.bmp'), ('GIF: Image/Annimation GIF','*.gif'), ('PNG: Portable Network Graphics','*.png'), ] ################################# # Initialisation de la fenetre: # ################################# fenetre=Tk() fenetre.title("Logiciel de dessin") # Zone de dessin zonedessin=LabelFrame(fenetre) zonedessin.configure(text="zone de dessin",bd=2,relief="groove") zonedessin.grid(row=1,rowspan=3,column=1,padx=10,pady=10) # Zone de type de selection selectionstyle=LabelFrame(fenetre) selectionstyle.configure(text="Type de sélection") selectionstyle.grid(row=1,column=2,padx=10,pady=10) acceptButton=LabelFrame(fenetre) acceptButton.grid(row=2,column=2,padx=10,pady=10) # Initialisation du canevas canevas=Canvas(zonedessin) canevas.configure(width=200,height=200,bg="white") # Fenetre de dialogue: Selection du fichier filename = tkFileDialog.askopenfilename(parent=fenetre,filetypes=myFormats,title='Selectionner l\'image à retoucher') # configuration du canevas: ouverture de l'image image = Image.open(filename) photo = ImageTk.PhotoImage(image) canevas.configure(width=image.size[0],height=image.size[1],bg="white") canevas.UsedImage = canevas.create_image(0,0, anchor = NW, image=photo) canevas.pack() couleur=IntVar() couleur.set(0) # configuration des types de sélection style=StringVar() style.set("portrait") rstyle1=Radiobutton(selectionstyle) rstyle1.configure(variable=style,value="portrait",text="portrait") rstyle1.grid(row=1,column=1) rstyle2=Radiobutton(selectionstyle) rstyle2.configure(variable=style,value="paysage",text="paysage") rstyle2.grid(row=1,column=2) # Bouton de découpe/sauvegarde bouton=Button(acceptButton) bouton.configure(text="Découper") bouton.pack() ############### # Evenements: # ############### ## Au clic => initialisé le rectangle de selection def ratioClic(event): global etatboutonsouris,x1,y1 etatboutonsouris="bas" x1=event.x y1=event.y x2=event.x y2=event.y if hasattr(canevas, "ratioSelectedRectangle"): canevas.delete(canevas.ratioSelectedRectangle) canevas.ratioSelectedRectangle = canevas.create_rectangle(x1,y1,x2,y2,fill='', outline='green', width=3) canevas.bind("<ButtonPress-1>",ratioClic) ## Au mouvement => bouger le rectangle de selection def mouvement(event): global etatboutonsouris,x,y,x1,y1 if (etatboutonsouris=="bas"): canevas.delete(canevas.ratioSelectedRectangle) if(style.get()=="portrait"): dif = x-x1 y = y1+int(dif*1.3) elif(style.get()=="paysage"): dif = y-y1 x = x1+int(dif*1.3) canevas.ratioSelectedRectangle = canevas.create_rectangle(x1,y1,x,y,fill='', outline='green', width=3) x=event.x y=event.y canevas.bind("<Motion>",mouvement) ## Au relachement du clic: figé le rectangle def ratioDeclic(event): global etatboutonsouris,x1,y1,x2,y2 etatboutonsouris="haut" x2=event.x y2=event.y if(style.get()=="portrait"): dif = x2-x1 y2 = y1+int(dif*1.3) elif(style.get()=="paysage"): dif = y2-y1 x2 = x1+int(dif*1.3) canevas.delete(canevas.ratioSelectedRectangle) canevas.ratioSelectedRectangle = canevas.create_rectangle(x1,y1,x2,y2,fill='', outline='green', width=3) canevas.bind("<ButtonRelease-1>",ratioDeclic) ## Sauvegarde def onSave(event): global image image = image.crop((x1, y1, x2, y2)) filename = tkFileDialog.asksaveasfilename(parent=fenetre,filetypes=myFormats,title="Enregistrer l'image sous...") if len(filename) > 0: image.save(filename) image.show(filename) tkMessageBox.showwarning("Fichier sauvegardé", "Le fichier a bien été enregistré\n") fenetre.destroy() fenetre.quit() os._exit(0) bouton.bind("<ButtonPress-1>",onSave) # Appel bouclé de la fenetre # fenetre.mainloop()
Code:
1
2
3
4
5
6
7
8
9
10 import py2exe from distutils.core import setup setup(windows=[{"script": "server.py", "icon_resources": [(1,"wfs.ico")] }], options = {"py2exe": {"optimize": 2, "bundle_files": 1, "compressed": 1}}, zipfile = None)
Et même erreur avec python 2.6.Citation:
C:\Python23>python.exe setup.py py2exe
running py2exe
*** searching for required modules ***
*** parsing results ***
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
writing byte-compilation script 'c:\docume~1\admini~1\locals~1\temp\tmpysv5ib.py
'
C:\Python23\python.exe -OO c:\docume~1\admini~1\locals~1\temp\tmpysv5ib.py
skipping byte-compilation of C:\Python23\lib\StringIO.py to StringIO.pyo
skipping byte-compilation of C:\Python23\lib\UserDict.py to UserDict.pyo
skipping byte-compilation of C:\Python23\lib\__future__.py to __future__.pyo
skipping byte-compilation of C:\Python23\lib\_strptime.py to _strptime.pyo
skipping byte-compilation of C:\Python23\lib\atexit.py to atexit.pyo
skipping byte-compilation of C:\Python23\lib\base64.py to base64.pyo
skipping byte-compilation of C:\Python23\lib\calendar.py to calendar.pyo
skipping byte-compilation of C:\Python23\lib\codecs.py to codecs.pyo
skipping byte-compilation of C:\Python23\lib\colorsys.py to colorsys.pyo
skipping byte-compilation of C:\Python23\lib\copy.py to copy.pyo
skipping byte-compilation of C:\Python23\lib\copy_reg.py to copy_reg.pyo
skipping byte-compilation of C:\Python23\lib\dis.py to dis.pyo
skipping byte-compilation of C:\Python23\lib\dummy_thread.py to dummy_thread.pyo
skipping byte-compilation of C:\Python23\lib\encodings\__init__.py to encodings\
__init__.pyo
skipping byte-compilation of C:\Python23\lib\encodings\aliases.py to encodings\a
liases.pyo
skipping byte-compilation of C:\Python23\lib\encodings\ascii.py to encodings\asc
ii.pyo
skipping byte-compilation of C:\Python23\lib\encodings\base64_codec.py to encodi
ngs\base64_codec.pyo
skipping byte-compilation of C:\Python23\lib\encodings\charmap.py to encodings\c
harmap.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp037.py to encodings\cp0
37.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1006.py to encodings\cp
1006.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1026.py to encodings\cp
1026.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1140.py to encodings\cp
1140.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1250.py to encodings\cp
1250.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1251.py to encodings\cp
1251.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1252.py to encodings\cp
1252.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1253.py to encodings\cp
1253.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1254.py to encodings\cp
1254.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1255.py to encodings\cp
1255.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1256.py to encodings\cp
1256.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1257.py to encodings\cp
1257.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp1258.py to encodings\cp
1258.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp424.py to encodings\cp4
24.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp437.py to encodings\cp4
37.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp500.py to encodings\cp5
00.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp737.py to encodings\cp7
37.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp775.py to encodings\cp7
75.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp850.py to encodings\cp8
50.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp852.py to encodings\cp8
52.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp855.py to encodings\cp8
55.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp856.py to encodings\cp8
56.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp857.py to encodings\cp8
57.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp860.py to encodings\cp8
60.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp861.py to encodings\cp8
61.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp862.py to encodings\cp8
62.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp863.py to encodings\cp8
63.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp864.py to encodings\cp8
64.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp865.py to encodings\cp8
65.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp866.py to encodings\cp8
66.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp869.py to encodings\cp8
69.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp874.py to encodings\cp8
74.pyo
skipping byte-compilation of C:\Python23\lib\encodings\cp875.py to encodings\cp8
75.pyo
skipping byte-compilation of C:\Python23\lib\encodings\hex_codec.py to encodings
\hex_codec.pyo
skipping byte-compilation of C:\Python23\lib\encodings\idna.py to encodings\idna
.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_1.py to encodings
\iso8859_1.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_10.py to encoding
s\iso8859_10.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_13.py to encoding
s\iso8859_13.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_14.py to encoding
s\iso8859_14.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_15.py to encoding
s\iso8859_15.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_2.py to encodings
\iso8859_2.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_3.py to encodings
\iso8859_3.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_4.py to encodings
\iso8859_4.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_5.py to encodings
\iso8859_5.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_6.py to encodings
\iso8859_6.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_7.py to encodings
\iso8859_7.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_8.py to encodings
\iso8859_8.pyo
skipping byte-compilation of C:\Python23\lib\encodings\iso8859_9.py to encodings
\iso8859_9.pyo
skipping byte-compilation of C:\Python23\lib\encodings\koi8_r.py to encodings\ko
i8_r.pyo
skipping byte-compilation of C:\Python23\lib\encodings\koi8_u.py to encodings\ko
i8_u.pyo
skipping byte-compilation of C:\Python23\lib\encodings\latin_1.py to encodings\l
atin_1.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_cyrillic.py to encodi
ngs\mac_cyrillic.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_greek.py to encodings
\mac_greek.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_iceland.py to encodin
gs\mac_iceland.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_latin2.py to encoding
s\mac_latin2.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_roman.py to encodings
\mac_roman.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mac_turkish.py to encodin
gs\mac_turkish.pyo
skipping byte-compilation of C:\Python23\lib\encodings\mbcs.py to encodings\mbcs
.pyo
skipping byte-compilation of C:\Python23\lib\encodings\palmos.py to encodings\pa
lmos.pyo
skipping byte-compilation of C:\Python23\lib\encodings\punycode.py to encodings\
punycode.pyo
skipping byte-compilation of C:\Python23\lib\encodings\quopri_codec.py to encodi
ngs\quopri_codec.pyo
skipping byte-compilation of C:\Python23\lib\encodings\raw_unicode_escape.py to
encodings\raw_unicode_escape.pyo
skipping byte-compilation of C:\Python23\lib\encodings\rot_13.py to encodings\ro
t_13.pyo
skipping byte-compilation of C:\Python23\lib\encodings\string_escape.py to encod
ings\string_escape.pyo
skipping byte-compilation of C:\Python23\lib\encodings\undefined.py to encodings
\undefined.pyo
skipping byte-compilation of C:\Python23\lib\encodings\unicode_escape.py to enco
dings\unicode_escape.pyo
skipping byte-compilation of C:\Python23\lib\encodings\unicode_internal.py to en
codings\unicode_internal.pyo
skipping byte-compilation of C:\Python23\lib\encodings\utf_16.py to encodings\ut
f_16.pyo
skipping byte-compilation of C:\Python23\lib\encodings\utf_16_be.py to encodings
\utf_16_be.pyo
skipping byte-compilation of C:\Python23\lib\encodings\utf_16_le.py to encodings
\utf_16_le.pyo
skipping byte-compilation of C:\Python23\lib\encodings\utf_7.py to encodings\utf
_7.pyo
skipping byte-compilation of C:\Python23\lib\encodings\utf_8.py to encodings\utf
_8.pyo
skipping byte-compilation of C:\Python23\lib\encodings\uu_codec.py to encodings\
uu_codec.pyo
skipping byte-compilation of C:\Python23\lib\encodings\zlib_codec.py to encoding
s\zlib_codec.pyo
skipping byte-compilation of C:\Python23\lib\getopt.py to getopt.pyo
skipping byte-compilation of C:\Python23\lib\inspect.py to inspect.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\FixTk.py to FixTk.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\Tkconstants.py to Tkconstant
s.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\Tkinter.py to Tkinter.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\tkCommonDialog.py to tkCommo
nDialog.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\tkFileDialog.py to tkFileDia
log.pyo
skipping byte-compilation of C:\Python23\lib\lib-tk\tkMessageBox.py to tkMessage
Box.pyo
skipping byte-compilation of C:\Python23\lib\linecache.py to linecache.pyo
skipping byte-compilation of C:\Python23\lib\locale.py to locale.pyo
skipping byte-compilation of C:\Python23\lib\macpath.py to macpath.pyo
skipping byte-compilation of C:\Python23\lib\ntpath.py to ntpath.pyo
skipping byte-compilation of C:\Python23\lib\opcode.py to opcode.pyo
skipping byte-compilation of C:\Python23\lib\os.py to os.pyo
skipping byte-compilation of C:\Python23\lib\os2emxpath.py to os2emxpath.pyo
skipping byte-compilation of C:\Python23\lib\popen2.py to popen2.pyo
skipping byte-compilation of C:\Python23\lib\posixpath.py to posixpath.pyo
skipping byte-compilation of C:\Python23\lib\quopri.py to quopri.pyo
skipping byte-compilation of C:\Python23\lib\random.py to random.pyo
skipping byte-compilation of C:\Python23\lib\re.py to re.pyo
skipping byte-compilation of C:\Python23\lib\repr.py to repr.pyo
skipping byte-compilation of C:\Python23\lib\sets.py to sets.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\BmpImagePlugin.py
to PIL\BmpImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\GifImagePlugin.py
to PIL\GifImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\GimpGradientFile.
py to PIL\GimpGradientFile.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\GimpPaletteFile.p
y to PIL\GimpPaletteFile.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\Image.py to PIL\I
mage.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageChops.py to
PIL\ImageChops.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageColor.py to
PIL\ImageColor.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageFile.py to P
IL\ImageFile.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageFilter.py to
PIL\ImageFilter.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageMode.py to P
IL\ImageMode.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImagePalette.py t
o PIL\ImagePalette.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageTk.py to PIL
\ImageTk.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\ImageTransform.py
to PIL\ImageTransform.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\JpegImagePlugin.p
y to PIL\JpegImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\PaletteFile.py to
PIL\PaletteFile.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\PngImagePlugin.py
to PIL\PngImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\PpmImagePlugin.py
to PIL\PpmImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\TiffImagePlugin.p
y to PIL\TiffImagePlugin.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\TiffTags.py to PI
L\TiffTags.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\PIL\__init__.py to PI
L\__init__.pyo
skipping byte-compilation of C:\Python23\lib\site-packages\zipextimporter.py to
zipextimporter.pyo
skipping byte-compilation of C:\Python23\lib\sre.py to sre.pyo
skipping byte-compilation of C:\Python23\lib\sre_compile.py to sre_compile.pyo
skipping byte-compilation of C:\Python23\lib\sre_constants.py to sre_constants.p
yo
skipping byte-compilation of C:\Python23\lib\sre_parse.py to sre_parse.pyo
skipping byte-compilation of C:\Python23\lib\stat.py to stat.pyo
skipping byte-compilation of C:\Python23\lib\string.py to string.pyo
skipping byte-compilation of C:\Python23\lib\stringprep.py to stringprep.pyo
skipping byte-compilation of C:\Python23\lib\tempfile.py to tempfile.pyo
skipping byte-compilation of C:\Python23\lib\token.py to token.pyo
skipping byte-compilation of C:\Python23\lib\tokenize.py to tokenize.pyo
skipping byte-compilation of C:\Python23\lib\traceback.py to traceback.pyo
skipping byte-compilation of C:\Python23\lib\types.py to types.pyo
skipping byte-compilation of C:\Python23\lib\warnings.py to warnings.pyo
removing c:\docume~1\admini~1\locals~1\temp\tmpysv5ib.py
*** copy extensions ***
*** copy dlls ***
copying C:\Python23\lib\site-packages\py2exe\run_w.exe -> C:\Python23\dist\imagi
ng.exe
Adding python23.dll as resource to C:\Python23\dist\imaging.exe
Adding zlib.pyd as resource to C:\Python23\dist\imaging.exe
The following modules appear to be missing
['_imaging_gif']
*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.
USER32.dll - C:\WINDOWS\system32\USER32.dll
IMM32.dll - C:\WINDOWS\system32\IMM32.dll
SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll
comdlg32.dll - C:\WINDOWS\system32\comdlg32.dll
COMCTL32.dll - C:\WINDOWS\system32\COMCTL32.dll
ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll
MSVCRT.dll - C:\WINDOWS\system32\MSVCRT.dll
GDI32.dll - C:\WINDOWS\system32\GDI32.dll
KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll
C:\Python23>
Le problème viendrai de la: "The following modules appear to be missing
['_imaging_gif']" ?
Si oui, comment m'en sortir ?
Si non.... comment m'en sortir ? :P
merci :)