FTP in Windows Mobile 6.1

Leandro - ProfessionalIT - Soluções em Tecnologia da Informação. <[email protected]> Fri, 13 Nov 2009 10:02:12 -0200
Newsgroups gmane.comp.python.windows-ce
Message-ID <[email protected]>
--===============1118315373==
Content-Type: multipart/alternative; boundary=00032555441a24e3f104783f6e0e

--00032555441a24e3f104783f6e0e
Content-Type: text/plain; charset=ISO-8859-1

Hello,

  This is my first post and I'm writing from Brazil.

Well,
   I'm developing a "Sales Force System" with PythonCE and PocketPyGui to a
Palm Tre Pro(with Windows Mobile 6.1 Professional, with touch screen
support) and in this moment I have two problems:

1) I do a W-Lan(wifi) connection and try send a file to a FTP server. In my
test I'm trying execute this code:

# ----- Begin ----
import ftplib
import os

def upload(ftp, file):
    ext = os.path.splitext(file)[1]
    if ext in (".txt", ".htm", ".html"):
        ftp.storlines("STOR " + file, open(file))
    else:
        ftp.storbinary("STOR " + file, open(file, "rb"), 1024)

ftp = ftplib.FTP("ftp.myserver.com.br")
ftp.login("myuser", "mypassword")

upload(ftp, "0011211B.EXP")

# ----- End ----

Well, when a execute this code (double-click in the windows explorer of my
mobile device) the pythonCE open and try execute the code but it show me
many errors(socket erros and a message: "Connection reset by peer"). When a
execute this code in my Desktop PC it's run ok. Any Idea of how to resolve
this problem or "how to send/put a file in a FTP server with PythonCE" ?

2) How to detect/make a GPRS connection with PythonCE ? There are a example
code ? where I can find a sample ? because the "sales man" will operate the
system out (in the "street") with a 3G GPRS Connection.

PS: Sorry by terrible English.

-- Leandro.

--00032555441a24e3f104783f6e0e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,<div><br></div><div>=A0=A0<span class=3D"Apple-style-span" style=3D"f=
ont-family: monospace; font-size: 16px; -webkit-border-horizontal-spacing: =
2px; -webkit-border-vertical-spacing: 2px; ">This is my first post=A0and I&=
#39;m writing from Brazil.</span></div>
<div><font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span c=
lass=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizont=
al-spacing: 2px; -webkit-border-vertical-spacing: 2px;">=A0</span></font></=
div><div>
<font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span class=
=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizontal-s=
pacing: 2px; -webkit-border-vertical-spacing: 2px;">Well,</span></font></di=
v><div>
<font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span class=
=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizontal-s=
pacing: 2px; -webkit-border-vertical-spacing: 2px;">=A0=A0 I&#39;m developi=
ng a &quot;Sales Force System&quot; with PythonCE and PocketPyGui to a Palm=
 Tre Pro(with Windows Mobile 6.1 Professional, with touch screen support) a=
nd in this moment I have two problems:</span></font></div>
<div><font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span c=
lass=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizont=
al-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><br></span></font><=
/div><div>
<font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span class=
=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizontal-s=
pacing: 2px; -webkit-border-vertical-spacing: 2px;">1) I do a W-Lan(wifi) c=
onnection and try send a file to a FTP server. In my test I&#39;m trying ex=
ecute this code:</span></font></div>
<div><font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span c=
lass=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizont=
al-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><br></span></font><=
/div><div>
<font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span class=
=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizontal-s=
pacing: 2px; -webkit-border-vertical-spacing: 2px;"># ----- Begin ----</spa=
n></font></div>
<div><font class=3D"Apple-style-span" face=3D"monospace" size=3D"4"><span c=
lass=3D"Apple-style-span" style=3D"font-size: 16px; -webkit-border-horizont=
al-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><div>import ftplib<=
/div><div>
import os</div><div><br></div><div>def upload(ftp, file):</div><div>=A0=A0 =
=A0ext =3D os.path.splitext(file)[1]</div><div>=A0=A0 =A0if ext in (&quot;.=
txt&quot;, &quot;.htm&quot;, &quot;.html&quot;):</div><div>=A0=A0 =A0 =A0 =
=A0ftp.storlines(&quot;STOR &quot; + file, open(file))</div>
<div>=A0=A0 =A0else:</div><div>=A0=A0 =A0 =A0 =A0ftp.storbinary(&quot;STOR =
&quot; + file, open(file, &quot;rb&quot;), 1024)</div><div><br></div><div>f=
tp =3D ftplib.FTP(&quot;<a href=3D"http://ftp.myserver.com.br">ftp.myserver=
.com.br</a>&quot;)</div>
<div>ftp.login(&quot;myuser&quot;, &quot;mypassword&quot;)</div><div><br></=
div><div>upload(ftp, &quot;0011211B.EXP&quot;)</div><div><br></div><div># -=
---- End ----</div><div><br></div><div>Well, when a execute this code (doub=
le-click in the windows explorer of my mobile device) the pythonCE open and=
 try execute the code but it show me many errors(socket erros and a message=
: &quot;Connection reset by peer&quot;). When a execute this code in my Des=
ktop PC it&#39;s run ok. Any Idea of how to resolve this problem or &quot;h=
ow to send/put a file in a FTP server with PythonCE&quot; ?</div>
<div><br></div><div>2) How to detect/make a GPRS connection with PythonCE ?=
 There are a example code ? where I can find a sample ? because the &quot;s=
ales man&quot; will operate the system out (in the &quot;street&quot;) with=
 a 3G GPRS Connection.</div>
<div><br></div><div>PS: Sorry by terrible English.</div><div><br></div><div=
>-- Leandro.</div></span></font></div>

--00032555441a24e3f104783f6e0e--

--===============1118315373==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PythonCE mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pythonce

--===============1118315373==--