473,903 Members | 4,818 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 1092
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
2340
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
2316
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
1879
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
1981
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
1702
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
1369
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
1691
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
3326
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
1833
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
9999
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
9847
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
11283
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10875
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...
1
10986
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10501
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8049
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
5894
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...
3
3324
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.