Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 05:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Python FTP Problem...

Discussion on Python FTP Problem... within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2013
Posts: 297
Received Thanks: 7
Arrow Python FTP Problem...

Hey Leute ich habe in Python ein FTP Programm geschrieben und hatte Hilfe von einigen Leuten (die nicht auf dieser Plattform vertretten sind!)

ich habe immer noch Probleme und deswegen würde ich gerne euch Fragen!

Code:
import ftplib
print '╔═══╗─────╔╗────╔═══╦╗──╔╗'
print '║╔═╗║─────║║────║╔═╗║╚╗╔╝║'
print '║║─║╠══╦══╣║╔══╗║╚═╝╠╗╚╝╔╝'
print '║╚═╝║╔╗║╔╗║║║║═╣║╔══╝╚╗╔╝'
print '║╔═╗║╚╝║╚╝║╚╣║═╣║║────║║'
print '╚╝─╚╣╔═╣╔═╩═╩══╝╚╝────╚╝'
print '────╚╝─╚╝'
print 'ApplePY'
server = raw_input ('FTP Server: ')
name = raw_input ('FTP Benutzername: ')
passwort = raw_input ('FTP Passwort: ')
upload = raw_input ('Datei zum Upload: ')

meinftp = ftplib.FTP(str(server)) 
meinftp.login(name,passwort)
 
 
directory = '/' 
 
meinftp.cwd(directory) 
 
directory_local='E:/Upload/' 
 
print "Server: So sieht der Inhalt von ",directory, " vor dem Upload aus:"
print
 
meinftp.retrlines('LIST')  
 
 
filename = str(upload)
 
print
print 'Ort und Name der lokalen Datei: ' + directory_local + filename
print
 
file = open(directory_local+filename, 'rb')
 
print 'Upload: ftp-Server: ' + directory +filename
 
#'STOR ' das geeignete ftp_Kommando
 
meinftp.storbinary('Stor '+filename, file)
 
print "ftp: So sieht der Inhalt von ",directory, " nach dem Upload aus:"
print
 
meinftp.retrlines('LIST')          
 
print
print 'Die lokale Datei ' + directory_local+filename +' wird geschlossen.'
 
 
file.close()
 
 
 
print meinftp.quit()
print
print 'Die FTP-Verbindung wurde getrennt.'
Hilft mir bitte
SBotDE is offline  
Old 04/13/2013, 08:13   #2
 
Atomix74's Avatar
 
elite*gold: 0
Join Date: Jan 2012
Posts: 271
Received Thanks: 94
Du nimmst Dir leider nur spärlich Zeit Dein Verständniss-Problem zu erläutern.
Aus diesem Grund auch nur eine Hilfestellung in Stichworten:

1) encoding?
Anm.: Tutorial Stuff
2) Fehler behandlung, try, expect?
Anm.: Tutorial Stuff
3) Passwörter niemals in Klartext auf dem Bildschirm ausgeben, readline.
Anm.: Erfahrung und Tutorial Stuff

Ansonsten, das Skript funktioniert sobald Punkt 1 abgehandelt wurde.

Wie auch schon im anderen Thread gesagt, schau Dir doch erst mal die Basics an. Damit sind dann Skripte wie dieses ein absolutes Kinderspiel.

Output:
Code:
atomix@obninsk:~/tmp$ python epvp_python_ftp_1.py 
╔═══╗─────╔╗────╔═══╦╗──╔╗
║╔═╗║─────║║────║╔═╗║╚╗╔╝║
║║─║╠══╦══╣║╔══╗║╚═╝╠╗╚╝╔╝
║╚═╝║╔╗║╔╗║║║║═╣║╔══╝╚╗╔╝
║╔═╗║╚╝║╚╝║╚╣║═╣║║────║║
╚╝─╚╣╔═╣╔═╩═╩══╝╚╝────╚╝
────╚╝─╚╝
ApplePY
FTP Server: localhost
FTP Benutzername: epvptest
FTP Passwort: 
Datei zum Upload: epvp_python_ftp_1.py
Server: So sieht der Inhalt von  ./  vor dem Upload aus:

-rw-r--r--    1 1001     1002         8445 Apr 16  2012 examples.desktop

Ort und Name der lokalen Datei: /home/atomix/tmp/epvp_python_ftp_1.py

Upload: ftp-Server: ./epvp_python_ftp_1.py
ftp: So sieht der Inhalt von  ./  nach dem Upload aus:

-rw-------    1 1001     1002         1624 Apr 13 08:09 epvp_python_ftp_1.py
-rw-r--r--    1 1001     1002         8445 Apr 16  2012 examples.desktop

Die lokale Datei /home/atomix/tmp/epvp_python_ftp_1.py wird geschlossen.
Atomix74 is offline  
Old 04/13/2013, 10:48   #3
 
elite*gold: 0
Join Date: Mar 2013
Posts: 297
Received Thanks: 7
Ich habe mir die Basics angekuckt und daher habe ich das mit dem input...
SBotDE is offline  
Reply


Similar Threads Similar Threads
[Python Problem]HELP ME!
12/11/2012 - Metin2 Private Server - 0 Replies
1211 17:23:06863 :: CPythonSkill::RegisterSkillDesc(dwSkillIndex=19) - Strange Skill Attribute(TOOGLE) 1211 17:23:06864 :: CPythonSkill::RegisterSkillDesc(dwSkillIndex=4) - Strange Skill Attribute(TOOGLE) 1211 17:23:18290 :: CMapOutdoor::Load - LoadMonsterAreaInfo ERROR 1211 17:24:33887 :: Traceback (most recent call last): 1211 17:24:33887 :: File "networkModule.py", line 231, in SetGamePhase 1211 17:24:33887 :: File "system.py", line 130, in __pack_import 1211 17:24:33887 :: ...
Python Problem!!!
08/22/2012 - Metin2 - 2 Replies
HeyHo ich bins mal wieder mit einem Python Problem xD undzwar wollte ich einfach mal wissen wie man VID's über eine gnaze map scannen kann =) ich kriege es nur so hin das ich alle VID's in sichtweite gefasst kriege bitte um hilfe!!!:handsdown::handsdown:
Python Problem
08/09/2012 - Metin2 - 2 Replies
Wollte mal eine frage an die Python kenne stellen ich habe ein Problem wollte mal mit Python in metin2 anfangen und wollte etwas ganz leichtes machen aber pustekuchen es funzt nicht..... import chat chat.AppendChat(chat.CHAT_TYPE_NOTICE, "Metin2 ")
[PROBLEM]Python Uhr
03/18/2012 - General Coding - 3 Replies
Hallo, Ich habe solch ein Script lt = time.localtime() jahr,monat,tag,stunde,minute,sekunde = lt zeit = "%02i:%02i:%02i" % (stunde, minute, sekunde) Nun mache ich z.b. "text" : zeit,
Python Problem.
10/29/2011 - Metin2 Private Server - 4 Replies
Hey Leute. Ich wollte gerade Python auf Freebsd 8.2 installieren nach dem Tut. http://www.elitepvpers.com/forum/metin2-pserver-g uides-strategies/937110-how2-python-f-r-alles.html Nach make install clean kommt ein Fenster ich gehe auf Close doch nun kommt. Horny# cd /usr/ports/lang/python Horny# make install clean ===> Installing for python-2.7,2 ===> python-2.7,2 depends on file: /usr/local/bin/python2.7 - not found



All times are GMT +2. The time now is 05:18.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.