Using with CSV library in Python 2.2!!!

M

mohan

Hi Guys,

I'm back one more basic question, this time on using CSV (Comma
Seperated Value) library with Python 2.2. At my workplace I have Python
2.2 installed and am using PythonWin 2.2.1 IDE from Mark Hammond.

I want to use the CSV library module for reading data from the .csv
files and when I try to import the module, I get the error "CSV module
is not found". The reason, CSV module is missing from the Python root
directories. Now my first question is,

1. Does Python 2.2 come with CSV library module or not? If yes, have I
lost it somewhere??

2. If Python 2.2 does not come with CSV module, is it possible to add
the CSV module to the Python root and start working??

3. If yes, where do I get this module from??

Would be glad to have an answer for these questions. Thanks in advance.

Cheers,
Mohan.
 
S

skip

mohan> 1. Does Python 2.2 come with CSV library module or not? If yes,
mohan> have I lost it somewhere??

As the docs for the csv module indicate, it was new in 2.3.

mohan> 2. If Python 2.2 does not come with CSV module, is it possible to
mohan> add the csv module to the Python root and start working??

You might find that it will work with 2.2, though you might have to make
some source code changes to _csv.c to get it to compile.

mohan> 3. If yes, where do I get this module from??

You can get both csv.py and _csv.c via ViewCVS:

http://svn.python.org/view/*checkou...ules/_csv.c?content-type=text/plain&rev=52574
http://svn.python.org/view/*checkout*/python/tags/r236/Lib/csv.py?content-type=text/plain&rev=52574

Skip
 
M

mohan

mohan> 1. Does Python 2.2 come with CSV library module or not? If yes,
mohan> have I lost it somewhere??

As the docs for the csv module indicate, it was new in 2.3.

mohan> 2. If Python 2.2 does not come with CSV module, is it possible to
mohan> add the csv module to the Python root and start working??

You might find that it will work with 2.2, though you might have to make
some source code changes to _csv.c to get it to compile.

mohan> 3. If yes, where do I get this module from??

You can get both csv.py and _csv.c via ViewCVS:

http://svn.python.org/view/*checkou...ules/_csv.c?content-type=text/plain&rev=52574
http://svn.python.org/view/*checkout*/python/tags/r236/Lib/csv.py?content-type=text/plain&rev=52574

Skip

Hi Skip,

Thanks man. What kind of source code changes should I do to "_csv.c"
file , have you any idea on that too??

Otherwise upgrading to Python 2.4 would be the easiest choice.

Thanks again.

cheers,
Mohan.
 
S

skip

mohan> Thanks man. What kind of source code changes should I do to
mohan> "_csv.c" file , have you any idea on that too??

I've no particular ideas. There are sometimes small C API changes between
feature releases though. If you read through the What's New document for
version 2.3 (google for it) you;ll probably have a pretty good idea of any
such changes.

mohan> Otherwise upgrading to Python 2.4 would be the easiest choice.

Oh, you didn't mention that. By all means, upgrade to 2.4 or 2.5 instead of
trying to backport the csv module to an outdated Python version.

Skip
 
L

Larry Bates

mohan said:
Hi Guys,

I'm back one more basic question, this time on using CSV (Comma
Seperated Value) library with Python 2.2. At my workplace I have Python
2.2 installed and am using PythonWin 2.2.1 IDE from Mark Hammond.

I want to use the CSV library module for reading data from the .csv
files and when I try to import the module, I get the error "CSV module
is not found". The reason, CSV module is missing from the Python root
directories. Now my first question is,

1. Does Python 2.2 come with CSV library module or not? If yes, have I
lost it somewhere??

2. If Python 2.2 does not come with CSV module, is it possible to add
the CSV module to the Python root and start working??

3. If yes, where do I get this module from??

Would be glad to have an answer for these questions. Thanks in advance.

Cheers,
Mohan.
Object Craft wrote the csv library that predated the one released in
Python 2.3. You can still get it for earlier Python versions here:

http://www.object-craft.com.au/projects/csv/download.html

-Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top