I have a code here and I just want to ask if what are the missing codes or what should I add so that every time I'm going to run this code a GUI will already appear and not the IDE/console anymore. - from ftplib import FTP
-
import os, sys, os.path, operator
-
import wx
-
-
host_name = raw_input("Enter your FTP Site: ")
-
if "http://" in host_name:
-
host_name = host_name.replace("http://","")
-
host_name = host_name.replace("\n","")
-
user = raw_input("Enter username: ")
-
pwd = raw_input("Enter password: ")
-
-
try: ftph = FTP(host_name)
-
except:
-
print "Host could not be resolved."
-
raw_input()
-
sys.exit()
-
else: pass
-
try:
-
ftph.login(user,pwd)
-
except Exception:
-
if user == "anonymous" or user == "Anonymous" and pwd == "anonymous" or pwd == "Anonymous":
-
print "The server does not accept anonymous requests."
-
raw_input()
-
sys.exit()
-
else:
-
print "Invalid login combination."
-
raw_input()
-
sys.exit()
-
else:
-
print "Successfully connected!\n"
-
print ftph.getwelcome()
-
flag = 1
-
count = 0
-
path = ftph.pwd()
-
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
-
-
def handleDownload(block):
-
file.write(block)
-
print ".",
-
-
ddir='#localdirectory'
-
os.chdir(ddir)
-
ftp = FTP('#ftpsite')
-
print 'Logged in!'
-
-
ftp.login('', '')
-
directory = '#ftpdirectory'
-
-
print 'Changing to ' + directory
-
ftp.cwd(directory)
-
ftp.retrlines('LIST')
-
print 'Downloading files...'
-
-
filenames = []
-
ftp.retrlines('NLST', filenames.append)
-
print filenames
-
-
for filename in filenames:
-
local_filename = os.path.join('#localdirectory', filename)
-
file = open(local_filename, 'wb')
-
ftp.retrbinary('RETR '+ filename, file.write)
-
-
file.close()
-
-
ftp.close()
-
0 997 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matt |
last post by:
I think this is the basic concept in ASP server-side development.
My boss told me web application is NOT client-server application. I argued
with him because browser is the client, and the server code put in server.
Then web application should be a client-server application. My understanding
is that a web application is an application that runs on a browser. But
client-server application is not necessary a web application.
Please...
|
by: Michael Rybak |
last post by:
hi, everyone.
I'm writing a 2-players game that should support network mode. I'm now
testing it on 1 PC since I don't have 2. I directly use sockets, and
both client and server do computations, the only data transfered is
user mouse/kbd input.
It works synchronously, but somehow, when I play in client window,
both client and server have 17 fps, while when playing in server
window, server has 44 fps while client ...
|
by: cjl |
last post by:
Hey all:
I know that it is silly in the age of Google to 'lose' something on the
internet, but I recently checked out a project that had implemented a
database with a subset of SQL in pure client-side javascript.
I forgot to bookmark it, and now I can't find it.
Anyone?
|
by: Ken Allen |
last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other
languages and done some COM work for a number of years. I am attempting to
understand how to map an older program architecture into .Net -- not looking
to do it at this time, just to understand how I would achieve it.
In the old environment, we had two classes, a client and a server class,
that managed a data object. The server object knew how to interface with the...
|
by: rs |
last post by:
how I the client tell the server that the socket is closed? or this there an
even that informs the server that the clients socket is close?
Oh, I am using vb.net 2003
Thanks
| |
by: J Huntley Palmer |
last post by:
I am having a horrific time integrating uw-imap's c-client for imap
support in php. The problem is a whole bunch of "Text relocation remains
referenced against symbol" errors during
linking. Any help appreciated!
The ordeal is a follows
I am using Solaris 10 with php5.1.1.
GCC:
|
by: khu84 |
last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output.
Following is the server code:-
<?php
function createSocketServer($host='192.168.1.34',$port=2222)
{
$max_clients = 10;
|
by: nsaffary |
last post by:
hi
I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set server machine IP for client and server) please guide me?
server :
#include <winsock2.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#pragma comment(lib, "ws2_32");
|
by: kashifjawed |
last post by:
I'm developing a c# asynchronous socket application for tranfering file or large data from client to server and server to client as well in chunks.
Application sometimes transfer file from client to server and sometimes not,
because connection betwenn client and server closed Abrupt.
I cannot understand why connection between client and server is closed while i cannot closed the connection until a single block
tranfered to server.
...
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |