473,703 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Somethng strange...(Mayb e)

2 New Member
hi there,...my name s roberto,from italy...ehm.... please...be patient for my english....howe ver 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(let tura)
file.close()
file2.close()
F1 = 'example2.txt'
F2 = 'example2.txt'
session = ftplib.FTP(serv er,user,passwd)
myfile = open(F1,'rb')
session.storbin ary('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....wh ats 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 1077
numberwhun
3,509 Recognized Expert Moderator Specialist
hi there,...my name s roberto,from italy...ehm.... please...be patient for my english....howe ver 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(let tura)
file.close()
file2.close()
F1 = 'example2.txt'
F2 = 'example2.txt'
session = ftplib.FTP(serv er,user,passwd)
myfile = open(F1,'rb')
session.storbin ary('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....wh ats 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
darkyng
2 New Member
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
2331
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 as a PDF file it clearly doesn't have a link back to our side. Under what circumstances might this happen? Thanks in advance!
5
2307
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 of code in question always crashes in an STL operation such as a vector.push_back, but the location of the crash changes as I change how various parts are handled in memory, i.e., make some things dynamically allocated instead of new'd. I know...
13
1865
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 message is all about. Any ideas? error: invalid initialization of non-const reference of
2
1969
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 std::exception. We have a base class which all processes derive from which is always instantiated in main surrounded by a try/catch(std::exception) which catches all exceptions that have not be handled at a higher level. The catch block cleans up and...
5
1689
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 have no clue why. But if I store the MethodInfo in a local variable I works as expected. I do not understand why this is so, shouldn't both ways be semantically equal?
0
1363
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 MathWS( the class name),and put it in a ..asmx file named math.asmx in the "D:/winnt/interpub/wwwroot/mathws" directory. "mathws" is my new-built directory. 2.run the http://localhost/mathws/math.asmx,find it works well,and run run the...
20
1671
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
3317
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: “Unexpected end of file while parsing Name has occurred” isbeing thrown. Following is the part o xml I am trying to read: <CHECK_ITEM_OUT>
2
1819
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 number and the shopping_cart_last_modified number is generated the same way once they check out... then an invoice number is generated by subtracting the two numbers (shopper_ID is older from when they registered). Is this strange or bad or...
0
8740
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8657
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9094
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7839
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6581
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5918
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.