473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

TextStream.ReadLine Mac Newline

I am using the textstream object to read a CSV file and parse through
the fields. I use the readline() method to read in each line of the
file, and parse the contents into the values of the different fields.

With files generated on a windows system, this works fine.

However, when working with CSV files genereated through Excel on a Mac,
the entire contents of the file is read when I make the first ReadLine
call. I imagine that this is because Mac uses a different newline
character than windows machines do (Carraige Return vc Carraige Return
+ Line Feed). I'm theorizing that ReadLine doesn't recognize just the
Carraige Return generated by a Mac.

Has anyone encountered an issue like this, or does anyone know of any
work arounds?

Thanks!
Mike Biang
mike -at- cramerdev dot com

Jan 8 '07 #1
1 2341
I found my own solution. Doing a bit more in depth search solved the
problem.

http://groups.google.com/group/micro...UTF-8&oe=UTF-8
mi********@gmail.com wrote:
I am using the textstream object to read a CSV file and parse through
the fields. I use the readline() method to read in each line of the
file, and parse the contents into the values of the different fields.

With files generated on a windows system, this works fine.

However, when working with CSV files genereated through Excel on a Mac,
the entire contents of the file is read when I make the first ReadLine
call. I imagine that this is because Mac uses a different newline
character than windows machines do (Carraige Return vc Carraige Return
+ Line Feed). I'm theorizing that ReadLine doesn't recognize just the
Carraige Return generated by a Mac.

Has anyone encountered an issue like this, or does anyone know of any
work arounds?

Thanks!
Mike Biang
mike -at- cramerdev dot com
Jan 9 '07 #2

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

Similar topics

12
by: Mike Maxwell | last post by:
When I invoke readline() in a for loop, why does it return a series of one-char strings, rather than the full line? >>> for sL in sys.stdin.readline(): print sL .... abc a b c
0
by: Steve Bright | last post by:
In an ASP page, I am using the FileSystemObject OpenTextFile method to initiate a TextStream object. In some files I have long lines and it appears that these are being truncated to 2048...
4
by: alberto | last post by:
In this code for a console application: int n; n = Console.Read(); Console.WriteLine(n); Console.ReadLine();
3
by: Piyush | last post by:
Hi, I am using the readline method in an application. The problem that creeps up is that for some particular line of text, even though it is < 512 characters, this method returns text only from...
1
by: AspProgrammer | last post by:
Hello I'm writing a web application where i upload a file. then i open the file use textstream. At the end of my application i close it by using TextStream.close. But when i try to delete the...
6
by: Christian Convey | last post by:
Hello, I've got a program that (ideally) perpetually monitors sys.stdin for lines of text. As soon as a line comes in, my program takes some action. The problem is, it seems like a very large...
2
by: Jan | last post by:
Hello there, I've got a strange problem using the readline method in vb2005 for reading the serial port. If I use the readchar method I can receive one character from serialport. This is the...
0
by: Arthur | last post by:
Given a "linemess.py" file with inconsistent line ending: line 1 \r \r\n line \n tokenized as per: import tokenize f=open('linemess.py','r')
1
by: Horta | last post by:
Hi folks, Sometimes, when I do an os.popen*(), the process executed by the command hangs, and the script stops forever on the readline()/ readlines() calls. I found that I can use select, but I'm...
0
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,...
0
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,...
0
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...
1
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
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.