Reuse Py Modules twixt Linux & Windoze?

Kirby Urner urner at alumni.princeton.edu
Sun Aug 27 11:38:23 EDT 2000


I just installed Linux-Mandrake in a partition on
my mostly Windows box.  So far so good.[1]

Very gratified to find Python already part of
the distro (1.5.2), including IDLE and Tk.
Bunderbar!

Now, Mandrake automounts all my Windows drives
by default, so I've got access to my Python 
1.6b or whatever, plus all the little modules
I've written in support of my 'math through
programming' curriculum writing.[2]

So naturally it occurs to me to do something
like this in Linux:

 >>> import /mnt/win_f/python16/ocn/coords

But here's the problem:  coords.py is tokenized
with all these /r thingys at the end of every
line.  I think I understand the reason:  DOS-based
Windows has always used ASCII CR-LF for end of 
line, while UNIX just uses /n (newline) -- so
I'm looking at all those ASCII LF characters,
yes?  Or are these CRs? (with kids we're going
to have to bring a physical typewriter into
the classroom -- which some have never seen --
to make sense of the "carriage return" 
terminology).

Now here's the question:  yes, I can write a 
program to strip the '/r's out of my Windoze
modules, but then they're going to be out of
whack when I reboot into that version of 
Python no?  So is it the case that I need to
clone all my modules and write routines to
convert back and forth?  Or is there some more
universal text format that'll let me store the
module once and only once and share it between
both OSs?

Kirby

PS:  actually, having written this, I'm now rather
confused.  OF COURSE all kinds of module files out
there on the net, some of which I've downloaded 
and used in Windows, were orginally written in 
Linux/Unix.  CLEARLY its very possible to share 
the same text source between OSs.  So my new question
is:  why haven't I encountered this problem before.
I think I'm missing something obvious here.  Please
be kind.  :-DDD (<- ingratiating grin plus double chin).

[1]  installation of Mandrake-Linux was pretty smooth,
as advertised, but I think my finger slipped at 2:30 AM
or something and I found myself looking at a 20 gig 
hard drive with only the new Linux partition usable,
all the FAT32 stuff inaccessible (gulp! -- not backed
up).  I swallowed hard, found some utility from Russia
or someplace, and managed to change a byte code in the
partition table that'd been misset to 85.  All back to
normal.  Whew!

[2] my "math through programming" (using a way better 
teaching language than Basic or C) is on-line at 
http://www.inetarena.com/~pdx4d/ocn/numeracy0.html
-- a four part essay, with Python mods downloadable
(so will Linux people see /r at the ends of all my
lines?)





More information about the Python-list mailing list