Question about file handles and windows handles @ Windows Operating Systems

2007-05-08 Thread eino
Very hard to find right function...

If I open file
fname="c:\\temp\\foobar.txt"
file_foobar = file(fname)
file_foobar.fileno()  returns  3   becausee of unix like library used
in windows python

If I'd like to get to known what windows handle it has

hfile=win32file.CreateFile( ff,win32con.GENERIC_READ|
win32con.GENERIC_WRITE,win32con.FILE_SHARE_READ|
win32con.FILE_SHARE_WRITE,None,
win32con.OPEN_ALWAYS,win32con.FILE_ATTRIBUTE_NORMAL , 0 )

hfile.handle returns 88

Are there any function to get windows handle of file which is already
opened with built-in file-function.

-Eino

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 and os.open question?

2005-01-11 Thread Eino Mäkitalo
Antoon Pardon wrote:
Why? What is it about the exclusive flag that
makes you like to use it?
Ok. Thanks, I misunderstood the meaning of flag.
What I' like to do is to open file and keep it exclusive locked for me.
Apparently this flag is not for me.
Eino Mäkitalo
--
http://mail.python.org/mailman/listinfo/python-list


Python 2.4 and os.open question?

2005-01-11 Thread Eino Mäkitalo
I just test in Windows XP with Python 2.4
I'd like to create a file with exclusive flag.
If file exist I try to use it, if not I'd like to create it.
Python (and underlying library) works differently with/without O_EXCL 
flag. Is this okay. How I should use this.

Has somebody manual :-) ?
Eino Mäkitalo
see scenarios (1 without flag ) (2 with flag)
Scenario 1:
To create file if it's not available this works ok
>>> aa=os.open("c:\\temp\\a.txt",os.O_RDWR|os.O_CREAT)
>>> os.close(aa)
>>> aa=os.open("c:\\temp\\a.txt",os.O_RDWR|os.O_CREAT)
>>> os.close(aa)
Scenario 2:
But if you try to do same with O_EXCL then it does not use same logic???
>>> aa=os.open("c:\\temp\\a.txt",os.O_RDWR|os.O_EXCL|os.O_CREAT)
>>> os.close(aa)
>>> aa=os.open("c:\\temp\\a.txt",os.O_RDWR|os.O_CREAT)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 17] File exists: 'c:\\temp\\a.txt'
--
http://mail.python.org/mailman/listinfo/python-list


Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Eino Mäkitalo
I had Visual C++ 6.0, so I compiled those
libpq.dll and psycopg.pyd.
if there are anyone to play with
Windows, Python 2.3 and Postgre-8.0.0-beta4 for windows like me.
You cat get those from: http://eino.net/html/python.html
Original psycopg source code is available in: 
http://initd.org/projects/psycopg1

I looking forward to see how much easier it will be with python 2.4
(free compiler), and psycopg2 (supporting python datetime etc).
Eino
--
http://mail.python.org/mailman/listinfo/python-list


Re: samba/windows shares (with python?)

2004-12-10 Thread Eino Mäkitalo
I.V. Aprameya Rao wrote:
hi
does anybody know how to access samba/windows shares on a network? is 
there any module that does this?

i am running linux and i thought of using the mount command to mount that 
remote share and then access it, but i was wondering whether that is the 
right way?

Aprameya
With python, CIFS client for python?
If not, try smbclient
Eino
--
http://mail.python.org/mailman/listinfo/python-list


urllib2 and Set-Cookie with "302 Moved temporarily"

2004-12-13 Thread Eino Mäkitalo
It seems that urrlib2 default redirection does not allow me to handle
Cookies. Service I'm trying seems to use IP switcher and session id's 
with cookies. After successful login it changes session id 
(PD-H_SESSION-ID) in 302 Moved temporarily. Urllib2 is so clever that it 
handles redirection but with wrong cookies.

Some hookings? Just own version from source.
What is the most lazy way to handle this. Older urllib?
Eino
-
HTTP/1.x 302 Moved Temporarily
Set-Cookie: BIGipServerWWW511_HTTP_Pool=1829440010.20480.; 
expires=Mon, 13-Dec-2004 11:55:59 GMT; path=/
Set-Cookie: 
PD-H-SESSION-ID=4_w5sBH4QGJ+UqZ0nfWTduFl4yYQj8WToCPG3PO-NPo9sAAslb; Path=/
Set-Cookie: 
PD-H-SESSION-ID=4_w5sBH4QGJ+UqZ0nfWTduFl4yYQj8WToCPG3PO-NPo9sAAslb; Path=/
Date: Mon, 13 Dec 2004 11:25:59 GMT
Message-Id: c365e552-4cf9-11d9-ab36-0a0a0b61aa77
Cache-Control: no-cache
Pragma: no-cache
Connection: close
Location: https://xxx/yyy/xxx/RepresentationApp
Content-Type: text/html
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib2 and Set-Cookie with "302 Moved temporarily"

2004-12-13 Thread Eino Mäkitalo
Fredrik Lundh wrote:
"Eino Mäkitalo" <[EMAIL PROTECTED]> wrote:
# this is ugly
Yes, but short and easy. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list