Win2k/Samba/win32file weirdness

Georg Mischler schorsch at schorsch.com
Thu Nov 2 08:11:25 EST 2000


Hi all,

just to report some strange problem I have encountered,
even if it probably isn't caused by Python or the Win32
extensions:

When accessing files on a Linux server running Samba from
a Windows2000 client, the function win32file.CreateFile()
is very likely to raise a "Permission denied" exception.
This happens even if the actual permissions are all fine
for creating that file and is most likely the consequence
of an incompatibility between Windows2000 and Samba.

The workaround is to open the file by other means:

myFile = open('myfile.txt', 'w')
myHandle = win32file._get_osfhandle(myFile.fileno())

Note that if you want to append to an existing file,
you'll have to explicitly move the file pointer to
the end of the file before writing, even if you
specified mode 'a' in the open:

win32file.SetFilePointer(myHandle, 0,
win32file.FILE_END)


I'm not sure if anything else can be done, eg. by tweaking
some Samba configuration parameters, or by fiddling with
the arguments of CreateFile(), neither of which I am
extremely familiar with. The purpose of this post is
more to point to the problem and one possible workaround.

Of course, if the win32 experts should find a solution
directly within that module, more power to them!


Have fun!

-schorsch

--
Georg Mischler  --  simulations developer  --  schorsch at schorsch.com
+schorsch.com+  --  lighting design tools  --  http://www.schorsch.com/


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list