471,310 Members | 1,137 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Somethng strange...(Maybe)

hi there,...my name s roberto,from italy...ehm....please...be patient for my english....however i have a question....im trying to know...why this strange thing appens....what?well look at this:


import ftplib

def main():
server = 'www.mysite.org'
user = 'mynick'
passwd = 'mypass'
file = open("C:\examle.txt" , "r")
lettura = file.read()
file2 = open("example2.txt" , "w")
file2.write(lettura)
file.close()
file2.close()
F1 = 'example2.txt'
F2 = 'example2.txt'
session = ftplib.FTP(server,user,passwd)
myfile = open(F1,'rb')
session.storbinary('STOR ' + F2, myfile)
myfile.close()
session.quit()

main()


Now...try it,with the double clik...nothing....the dos window will pop up without do anithing...and now...open the file,and press run...(i use the idle...not active python)...see? now it work....if i open it with pythonwin it gives me :

error: (10061, 'Connection refused')

but if i open it with the standard IDLE(on my machine i have,python2.3,2.5 and active python installed) its works....how can be possible?

anyone can help me? i want to do a thing who use ftp protocol,with GUI too...but it dont work with the double clik...but just the IDLE......
so if i want to make an exe,i cant use the IDLE:..so....whats wrong with me? why it work with the IDLE e not the double clik?


sorry....to bother you,and my english errors(horrors xD)...

thank you
Jan 3 '08 #1
2 1004
numberwhun
3,503 Expert Mod 2GB
hi there,...my name s roberto,from italy...ehm....please...be patient for my english....however i have a question....im trying to know...why this strange thing appens....what?well look at this:


import ftplib

def main():
server = 'www.mysite.org'
user = 'mynick'
passwd = 'mypass'
file = open("C:\examle.txt" , "r")
lettura = file.read()
file2 = open("example2.txt" , "w")
file2.write(lettura)
file.close()
file2.close()
F1 = 'example2.txt'
F2 = 'example2.txt'
session = ftplib.FTP(server,user,passwd)
myfile = open(F1,'rb')
session.storbinary('STOR ' + F2, myfile)
myfile.close()
session.quit()

main()


Now...try it,with the double clik...nothing....the dos window will pop up without do anithing...and now...open the file,and press run...(i use the idle...not active python)...see? now it work....if i open it with pythonwin it gives me :

error: (10061, 'Connection refused')

but if i open it with the standard IDLE(on my machine i have,python2.3,2.5 and active python installed) its works....how can be possible?

anyone can help me? i want to do a thing who use ftp protocol,with GUI too...but it dont work with the double clik...but just the IDLE......
so if i want to make an exe,i cant use the IDLE:..so....whats wrong with me? why it work with the IDLE e not the double clik?


sorry....to bother you,and my english errors(horrors xD)...

thank you
Ok, if you have the code in a file, called <whatever>.py, open a command line, go to the directory where the file is and type "python <filename>", replacing <filename> with the name of your python script.

I am having you do this because when you double click the script, the command window that opens is only temporary and immediately closes when the script finishes or errors out, not allowing you to examine any errors.

Also, please make sure that ftp'ing over to the site does work on the command line before continuing.

Regards,

Jeff
Jan 5 '08 #2
Ok, if you have the code in a file, called <whatever>.py, open a command line, go to the directory where the file is and type "python <filename>", replacing <filename> with the name of your python script.

I am having you do this because when you double click the script, the command window that opens is only temporary and immediately closes when the script finishes or errors out, not allowing you to examine any errors.

Also, please make sure that ftp'ing over to the site does work on the command line before continuing.

Regards,

Jeff
thanks for your answer,however i got this thing:
raise socket.error, msg
socket.error: (10061, 'connection refused')

this error i got it if i do the double clik or open it with the dos command
if i use the idle...well,i pressed F5 and...nothing...its all ok,it works...
how can this possible? why with the double clik it dont open but with the idle it works?????????
RI-sorry for my bad english....

thanks
Jan 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Ryann | last post: by
13 posts views Thread by Neil Zanella | last post: by
2 posts views Thread by Paul Drummond | last post: by
20 posts views Thread by SpreadTooThin | last post: by
2 posts views Thread by Paul Furman | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.