On Oct 8, 2010, at 4:27 PM, Ian Kelly wrote:
On Fri, Oct 8, 2010 at 3:52 PM, <aurfal...@gmail.com> wrote:
Hi all,
Unsure how to deal with what appears to be \n vs \r issues.
The following code works in Linux;
o = open("axenfs.reg")
n = open("axenfs2.reg", "a")
while 1:
line = o.readline()
if not line: break
line = line.replace("dword:00000","dword:0000044e")
n.write(line)
n.close()
But in Windows, its one continues line with a bunch of squares in it.
So I add + '\r\n' to my second to last line so it looks like;
n.write(line + '\r\n')
But I still get one continuous line with squares in it.
Any ideas? I've been googing all day to no avail.
Is the input file formatted the same way? I would guess that the
readline call is reading the input file as one continuous line, so
that the loop body only runs once, and the '\r\n' only gets added to
the very end of the file.
Hi Ian,
Thanks very much for the reply.
It took a very long time to get my approval mail for this list, so in
the interum, I fix it this way (in the event other noobs have issues
like myself).
First, I replaced "a" with "ab" as Winblows treats text files diff
then Unix.
Second, I used variables instead of actual text so "dword:00000" is
really a var named oldhexuid. And "dword:0000044e" is really a new
var called newhexuid.
What I am really doing here is using NFS in 64 bit Windows XP via
AxeNFS client which also works in Windows 7.
If you are asking why as Windows 7 does have NFS, it does not map UIDs
like Windows XP 32 + SFU can do. So basically I load an LDAP plugin
for Windows called pGina which is an LDAP client for Windows.
Then during login, I NFS mount, scan a Linux passwd file on that NFS
mount for the matching UID of the logged in Windows user and mod the
reg so that the windows user UID matches the Linux UID.
This way when they mod a file/ folder on the NFS mount, its got
proper UID/GID values system wide.
Its really too bad the Windows 7 doesn't support NFS map files in
terms of matching users with UID/GID.
And I didn't want to use Samba as I like my OpenLDAP servers clean and
tidy.
Since the reg value is in hex, I had to convert the decimal value
derived from the passwd file to hex via a sysinternals program called
hex2dec. Its this value that I use to mod the reg for AxeNFS.
This was a royal PITA but my constraints were clear and no flexible.
Hope this helps others.
- aurf
--
http://mail.python.org/mailman/listinfo/python-list