Reuse Py Modules twixt Linux & Windoze?

lynx a at b.c
Sun Aug 27 13:06:27 EDT 2000


Kirby Urner <urner at alumni.princeton.edu>, in
<t6diqs88c3q6vjubrm95268pmom0i47eog at 4ax.com>:

[...]
> 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?

there's a hack you can use to make the kernel (the fat filesystem module)
convert the line-endings for you on the fly; give mount the "conv=auto"
option.

in practice, you would: (1) su to root, (2) open an editor on your /etc/fstab
file, (3) look for the line(s) that automount the DOS FAT filesystems in
question, (4) insert the "conv=auto" in the options section of these. those
lines would end up looking analogous to this, more or less:

/dev/hdXY       /mnt/dos        vfat    nosuid,nodev,conv=auto 0 0

notice the "conv=auto" and how the options are comma-separated. that's the
only part you want to change, don't touch anything else in these lines
unless you *really, really* know what you're doing. don't touch any of the
other lines, either. trust me on this, i had to learn the hard way lo those
many years ago.

one possible stumbling block: i'm unsure how your particular version of
Mandrake Linux does the automounting of vfat partitions. i'm assuming it
uses mount and fstab like any other filesystem, because that's the sensible
way. but if it uses some sort of automounting daemon, i'm out of my depth.

another one: this option will automagically convert line endings on *text*
files. well, how does the kernel know what's a text file? it guesses that a
file is text if it doesn't have a "well-known binary" extension. that sort
of guesswork is what kernel developers call a "godawfully ugly hack". you
might want to read the man page for mount(8) to find out what these "well
known" extensions are, so you won't get bitten.

> 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.

probably you've been downloading them to windows in text format. then, either
your ftp program will convert them for you, or you've downloaded them in .zip
files and their authors have done the conversion for you. that's just my guess,
though.




More information about the Python-list mailing list