473,581 Members | 2,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to FTP a ASCII file

Hi,

My program has the following code to transfer a binary file

f = open(pathanme+f ilename,'rb')
print "start transfer"
self.fthHandle. storbinary('STO R '+filename, f)

How can I do an ASCII file transfer??????
-Ted

Jul 2 '07 #1
2 3866
On Jul 3, 9:02 am, "tedpot...@gmai l.com" <tedpot...@gmai l.comwrote:
Hi,

My program has the following code to transfer a binary file

f = open(pathanme+f ilename,'rb')
print "start transfer"
self.fthHandle. storbinary('STO R '+filename, f)

How can I do an ASCII file transfer??????
-Ted
I'm really curious as to how you could find out how to upload a file
in binary mode, but not in ASCII mode.

According to The Fantastic Manual:
"""
storbinary( command, file[, blocksize])

Store a file in binary transfer mode. command should be an appropriate
"STOR" command: "STOR filename". file is an open file object which is
read until EOF using its read() method in blocks of size blocksize to
provide the data to be stored. The blocksize argument defaults to
8192. Changed in version 2.1: default for blocksize added.

storlines( command, file)

Store a file in ASCII transfer mode. command should be an appropriate
"STOR" command (see storbinary()). Lines are read until EOF from the
open file object file using its readline() method to provide the data
to be stored.
"""

Jul 2 '07 #2
On Jul 2, 7:12 pm, John Machin <sjmac...@lexic on.netwrote:
On Jul 3, 9:02 am, "tedpot...@gmai l.com" <tedpot...@gmai l.comwrote:
Hi,
My program has the following code to transfer a binary file
f = open(pathanme+f ilename,'rb')
print "start transfer"
self.fthHandle. storbinary('STO R '+filename, f)
How can I do anASCIIfile transfer??????
-Ted

I'm really curious as to how you could find out how to upload a file
in binary mode, but not inASCIImode.

According to The Fantastic Manual:
"""
storbinary( command, file[, blocksize])

Store a file in binary transfer mode. command should be an appropriate
"STOR" command: "STOR filename". file is an open file object which is
read until EOF using its read() method in blocks of size blocksize to
provide the data to be stored. The blocksize argument defaults to
8192. Changed in version 2.1: default for blocksize added.

storlines( command, file)

Store a file inASCIItransfer mode. command should be an appropriate
"STOR" command (see storbinary()). Lines are read until EOF from the
open file object file using its readline() method to provide the data
to be stored.
"""
Hi,
I did a google on python file transfer and got links to sample code
using a binary transfer, but thier was no links to sample code using
ascc. Thank you for your help

Jul 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
10684
by: Peter Wilkinson | last post by:
Hello tlistmembers, I am using the encoding function to convert unicode to ascii. At one point this code was working just fine, however, now it has broken. I am reading a text file that has is in unicode (I am unsure of which flavour or bit depth). as I read in the file one line at a time (readlines()) it converts to ascii. Simple enough....
4
6052
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using...
2
6192
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program (its name i cannot recall now...) where I designed the "screen" using this "program" and then saved it into an ASCII file. (thus, using 'extended'...
3
24494
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine for decrypting the file works fine however when I encrypt the file, several characters are corrupted. when I looked into it they are always extended...
18
34100
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found Encoding.Convert, but that needs byte arrays. Thanks, /Ger
13
3540
by: greg | last post by:
Hello, I'm searching to know if a local file is ascii or binary. I couldn't find it in the manual, is there a way to know that ? thanks, -- greg
7
4024
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value. However, at the moment I am just getting more gibberish so I'm probably doing something wrong. I tried using ASCII Encoding before to get the ASCII...
5
6180
by: Mike Currie | last post by:
Can anyone explain why I'm getting an ascii encoding error when I'm trying to write out using a UTF-8 encoder? Thanks Python 2.4.3 (#69, Mar 29 2006, 17:35:34) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> filterMap = {} >>> for i in range(0,255):
18
9042
by: John | last post by:
Hi, I'm a beginner is using C# and .net. I have big legacy files that stores various values (ints, bytes, strings) and want to read them into a C# programme so that I can store them in a database. The files are written by a late 1980's PC Pascal programme, for which I don't have the source code. I've managed to reverse engineer the file...
4
25054
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. Anybody please help in c language. Thanks in Advance.
0
7862
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7789
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...
0
8144
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. ...
1
7894
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...
0
8169
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...
0
6551
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3803
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...
1
2300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1400
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.