ASV module, CVS modules
John Machin
sjmachin at lexicon.net
Fri Mar 1 00:32:06 EST 2002
ron at ire.org (ron nixon) wrote in message news:<61ff32e3.0202281525.3e9bb102 at posting.google.com>...
> Hello, I'm trying to use either of these two modules ASV by Laurence
> Tratt at http://tratt.net/laurie/python/asv/ and CSV by Dave Cole at
> http://object-craft.com.au/projects/csv/. I tried both of these and
> get this error:
>
> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.8 -- press F1 for help
> >>> import ASV
> >>> my_data = ASV.ASV()
> >>> my_data.input_from_file("c:\test_data.csv", ASV.CSV(),
> has_field_names =1)
> Traceback (most recent call last):
> File "<pyshell#2>", line 1, in ?
> my_data.input_from_file("c:\test_data.csv", ASV.CSV(),
> has_field_names =1)
> File "C:\PYTHON22\ASV.py", line 222, in input_from_file
> file = open(input_file, "rb")
> IOError: invalid argument: rb
> >>>
>
> I get a similar message from CSV module. Anyone use either of these
> and can tell me what's wrong?
>
Wow. You have two problems. Bill Gates has one. And one of either you
or Dave Cole will get busted real soon now if you keep smoking that
stuff :-)
To be more explicit:
You 1: Don't clutter the root directory of your C: drive with anything
other than "necessary" directories, and files other than what Bill &
other software providers dump in there.
You 2: On Windows, either use forward slashes "c:/test_data.csv" (it
works!) -- recommended -- or use raw strings r"c:\test_data.csv" if
you must. The problem is that Python's escape handling intervenes;
what Bill's software got to see in your case was equivalent to "C:" +
a_bloody_tab_character + "est_data.csv" !!!
Bill behaving badly: Seems like Bill chucks a wobbly if there is
a_bloody_tab_character in a file name. I could be maligning Bill
unjustly; could be GvR & Co -- I'll have a look at the Python source
in a minute -- but I'd bet a couple of pots of beer that it's down to
Bill.
You and/or Dave in peril of the law: Last time I saw Dave's module it
didn't presume to read files at all, it expected you to read lines and
pass them to it one at a time. So either Dave has had a very recent
rush of blood or something worse to the head and released unbeknownst
to me a file-handling version of his module, or you are gravely
mistaken when you assert "I get a similar message from CSV module".
Hope this helps,
John
More information about the Python-list
mailing list