Python - [Ayuda] Error al ejecutar Script.

 
Vista:

[Ayuda] Error al ejecutar Script.

Publicado por Daniel (2 intervenciones) el 10/11/2014 01:47:53
Buenas compas, estoy intentando ejecutar este script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#Enter your domain, username and password below within double quotes
# eg. domain="yourdomain.com", username="username" and password="password"
domain="yourdomain.com"
username="username"
password="password"
com="wget -q -O - https://mail.google.com/a/"+domain+"/feed/atom --http-user="+username+"@"+domain+" --http-password="+password+" --no-check-certificate"
 
temp=os.popen(com)
msg=temp.read()
index=msg.find("<fullcount>")
index2=msg.find("</fullcount>")
fc=int(msg[index+11:index2])
 
if fc==0:
   print "0 new"
else:
   print str(fc)+" new"

Pero al ejecutarlo, me tira este error:

1
2
./gmail.py: línea 10: error sintáctico cerca del elemento inesperado `('
./gmail.py: línea 10: `temp=os.popen(com)'

Desde ya muchas gracias por su respuesta!!

PD: Culaquier dato que me falte me dicen.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 2.239
Plata
Ha mantenido su posición en Python (en relación al último mes)
Gráfica de Python

[Ayuda] Error al ejecutar Script.

Publicado por xve (1646 intervenciones) el 10/11/2014 08:20:46
Hola Daniel, a mi me ha funcionado perfectamente!!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
 
#Enter your domain, username and password below within double quotes
# eg. domain="yourdomain.com", username="username" and password="password"
domain="dominio"
username="usuario"
password="contraseña"
com="wget -q -O - https://mail.google.com/a/"+domain+"/feed/atom --http-user="+username+"@"+domain+" --http-password="+password+" --no-check-certificate"
 
temp=os.popen(com)
msg=temp.read()
print msg
index=msg.find("<fullcount>")
index2=msg.find("</fullcount>")
fc=int(msg[index+11:index2])
 
if fc==0:
   print "No hay nuevos mensajes"
else:
   print str(fc)+" nuevos mensajes"

Yo lo he ejecutado con Python 2.7.x sobre Linux


Cual es tu linea 10?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar