473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1068
numberwhun
3,509 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

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

Similar topics

5
by: Ryann | last post by:
Hello. I had a strange entry in my referrer logs. The http-referrer reported that the user came from another site. But the file it claimed to come from a pdf file. I followed the link back and...
5
by: Rob Ristroph | last post by:
Hi, It's pretty unhelpful to post "I have a huge piece of code that crashes in strange places, what's the problem?" but that's basically my problem and I really am at my wit's end. The piece...
13
by: Neil Zanella | last post by:
Hello, I wonder whether anyone has ever come across the following g++ compiler error message. I don't recall ever seeing it before. I solved my problem but I am still not sure about what this...
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
5
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
0
by: han zhiyang | last post by:
I've just studied the "how to" web service and the async pattern in donnet.I make a test with these knowledges,but I got a strange result. Here is my test. 1.Write a simple "Add" service named...
20
by: SpreadTooThin | last post by:
I have a list and I need to do a custom sort on it... for example: a = #Although not necessarily in order def cmp(i,j): #to be defined in this thread. a.sort(cmp) print a
3
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception:...
2
by: Paul Furman | last post by:
I don't know, maybe this isn't strange but someone else set up the shopping card coding I'm working with, the way it works is to get the time() in seconds like 1172693735 and that's the shopper_ID...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.