From chezdique@yahoo.com Wed Jan 1 10:22:11 2003 From: chezdique@yahoo.com (dique) Date: Wed, 1 Jan 2003 02:22:11 -0800 (PST) Subject: [python-win32] Re: ASP, Python 2.2 In-Reply-To: Message-ID: <20030101102211.16941.qmail@web13306.mail.yahoo.com> I was having the same problem with ActivePython distribution. The problem vanished after I reinstalled python separately with the standard distribution from www.python.org and win32all from Mark Hammond's site. --- Don Dwiggins wrote: > Michael Rothwell writes: > > 2) page displays once, then doesn't display again. > > The first time a access an ASP page from a > browser, it runs properly and > > displays the contents I would expect. The second > time, it doesn't return > > anything but this: > > > > > > updating the timestamp on the .asp file makes it > work again -- once. What > > can I do to fix this? > > This is a known problem in win32all; you can > probably find a discussion of > it in the archives. The short answer is: get the > file "framework.py" from > win32all build 133 (do a search to find the > directory it's in) to replace > the one in the distribution. Mark recommended 150, > but that one didn't work > for me. > > Sorry I don't have more explicit info; I'm away from > the office. > -- > > Don Dwiggins "The truth will make you free, > d.l.dwiggins@computer.org but first it will > make you miserable" > -- Tom DeMarco > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From kylelin@gamania.com Thu Jan 2 06:25:53 2003 From: kylelin@gamania.com (=?big5?B?p96zTqzjtW+zoS1LdWxlIExpbiiqTKRsslcp?=) Date: Thu, 2 Jan 2003 14:25:53 +0800 Subject: [python-win32] Quiz about debugging Python. Message-ID: <5000C23E17ED6E4D9C501578674E6C4A108ED0@TP-EX-03.gamania.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2B227.CCE23306 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi, =20 Could any one help me on debugging with Python? The platform I=A1=A6m = running Python is Windows 2000. =20 Every time I run python_d.exe (debug mode python) and try to import a = dll from directory =A1=A7DLLs=A1=A8, it seems not be able to recognize = it~~ However, python.exe (release mode) does work~ =20 Since I=A1=A6ve created a user defined dll and try to debug it with = python, if I compile the dll into debug mode and run on release mode = python (python.exe) it would crash instantly, if on debug mode python = (python_d.exe) then it would say can=A1=A6t find the module. Is there = any other possible way to get into my dll? Please help me! =20 Thank you very much! =20 Kyle Lin. ------_=_NextPart_001_01C2B227.CCE23306 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable

Hi,

 

Could any one help me on = debugging with Python? The platform I=A1=A6m running Python is Windows = 2000.

 

Every time I run python_d.exe = (debug mode python) and try to import a dll from = directory =A1=A7DLLs=A1=A8, it seems not be able to recognize it~~ However, = python.exe (release mode) does work~

 

Since I=A1=A6ve created a user = defined dll and try to debug it with python, if I compile = the dll into debug mode and run on release mode python (python.exe) it would crash instantly, if on debug mode python = (python_d.exe) then it would say can=A1=A6t find the module. Is there any other = possible way to get into my dll? Please help = me!

 

Thank you very = much!

 

Kyle = Lin.

------_=_NextPart_001_01C2B227.CCE23306-- From rothwell@holly-springs.nc.us Fri Jan 3 05:05:59 2003 From: rothwell@holly-springs.nc.us (Michael Rothwell) Date: Fri, 03 Jan 2003 00:05:59 -0500 Subject: [python-win32] main loop? Message-ID: <3E151A37.5070302@holly-springs.nc.us> Is there something like glib's main loop available for use with Python? -Michael From cody@hpcs.com Sun Jan 5 17:27:00 2003 From: cody@hpcs.com (Cody Pisto) Date: Sun, 05 Jan 2003 10:27:00 -0700 Subject: [python-win32] win32 shell SHGetFileInfo? Message-ID: <3E186AE4.3000204@hpcs.com> Is there any way to get at the win32 shell SHGetFileInfo call from the win32all python modules? Im trying to get the associated icon for a file on win32, but I see this function is not exposed via the win32com.shell shell module for python. Anyone have any other suggestions on how one might go about retrieving the shell associated icons? Thanks- Cody Pisto From tony@tcapp.com Mon Jan 6 06:23:50 2003 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 05 Jan 2003 22:23:50 -0800 Subject: [python-win32] Python Win32 build 150- bottom lines not visible when window is not maximized In-Reply-To: <001901c2ab98$6de63fa0$87163b41@robinjim> References: <5.1.0.14.0.20021221230833.00b14ce8@smtp.sbcglobal.net> <5.1.0.14.0.20021223170129.03b413f0@tcapp.com> Message-ID: <5.1.0.14.0.20030105222245.03dd7580@tcapp.com> > > >>When I did use a 28 point font on a Windows XP machine, I did observe the I've tried the small fonts- and this seem to be ok now. I still prefer the large fonts though. >----- Original Message ----- >From: "Tony Cappellini" >To: "robin and jim" >Sent: Monday, December 23, 2002 6:02 PM >Subject: Re: [python-win32] Python Win32 build 150- bottom lines not visible >when window is not maximized > > > > > > By any chance-do you use the large fonts ? > > I use these on all my machine, and it seems as though most SW developers > > completely overlook this issue, which usually causes screen layout >problems. > > I need to try small fonts to see if it changes this problem. > > > > Tony > > > > At 03:55 AM 12/23/2002 -0700, you wrote: > > >Hello Tony, > > > > > >I'm also using build 150 and have not seen these problems on any of: > > > > > > Windows 98 > > > Windows 2000 professional > > > Windows XP home edition > > > > > >----- Original Message ----- > > >From: "Tony Cappellini" > > >To: > > >Sent: Sunday, December 22, 2002 12:13 AM > > >Subject: [python-win32] Python Win32 build 150- bottom lines not visible > > >when window is not maximized > > > > > > > > > > > > > > > > > > I'm using build 150 on a WIn32 machine. > > > > If the Python Win32 IDE is not maximized, you cannot see that last few > > >lines. > > > > > > > > > > > > Also, when I type a module name, followed by a '.', and let the >command > > > > line completion window be displayed, the dropdown box is not fully > > >displayed. > > > > > > > > > > > > Has anyone else seen these types of problems ? > > > > > > > > > > > > thanks > > > > > > > > Tony > > > > > > > > > > > > _______________________________________________ > > > > Python-win32 mailing list > > > > Python-win32@python.org > > > > http://mail.python.org/mailman/listinfo/python-win32 > > From tony@tcapp.com Mon Jan 6 06:27:27 2003 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 05 Jan 2003 22:27:27 -0800 Subject: [python-win32] Setting PYTHONSTARTUP In-Reply-To: <3E08780D.2040706@tallan.com> References: <5.1.0.14.0.20021223220338.02416678@smtp.sbcglobal.net> <5.1.0.14.0.20021223220338.02416678@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20030105222532.03de01f8@tcapp.com> > >>Just as a sanity check have you verified that the env variable is being > passed to python? > > >>import os > >>print os.environ['PYTHONSTARTUP'] > Yes, the directory I've specified is being seen when I print that environment var, but pythonWin won't see the scripts, unless I manually cd to that directory each time I start PythonWin. There's got to be a better way to get this thing configured. >Tony Cappellini wrote: > >> >>I've added the PYTHONSTARTUP variable to control panel, on Win2000,and put >>a print statement in the file, so I know IF it's being executed. >>After launching PythonWin, I never see the print statement, nor the >>effects from changing directories, which I've also added to the file >>pointed to by PYTHONSTARTUP.. >> >>Strangely enough, neither IDLE, Ipython, nor PythonW32 see the startup >>file, so what am I doing wrong ? >> >> >>thanks >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 > > >-- >Jens B. Jorgensen >jens.jorgensen@tallan.com > >"With a focused commitment to our clients and our people, we deliver value >through customized technology solutions" > > From tony@tcapp.com Mon Jan 6 06:25:17 2003 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 05 Jan 2003 22:25:17 -0800 Subject: [python-win32] Setting PYTHONSTARTUP In-Reply-To: <3E087F9A.F8FC8F60@noaa.gov> References: <5.1.0.14.0.20021223220338.02416678@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20030105222410.03dd9988@tcapp.com> > >>Tony, I believe PYTHONSTARTUP is only used by the interactive > **command** line > >>interpreter; if you enter *python* on a command line, you should see > your print > >>statement. Ok- so how do I get PythonWin to cd into the directory where my scripts are, when it is launched, so I dont have to do it manually each time ? >Tony Cappellini wrote: > > > I've added the PYTHONSTARTUP variable to control panel, on Win2000,and put > > a print statement in the file, so I know IF it's being executed. > > After launching PythonWin, I never see the print statement, nor the effects > > from changing directories, which I've also added to the file pointed to by > > PYTHONSTARTUP.. > > > > Strangely enough, neither IDLE, Ipython, nor PythonW32 see the startup > > file, so what am I doing wrong ? > > > > thanks > > > > _______________________________________________ > > Python-win32 mailing list > > Python-win32@python.org > > http://mail.python.org/mailman/listinfo/python-win32 From theller@python.net Mon Jan 6 09:20:10 2003 From: theller@python.net (Thomas Heller) Date: 06 Jan 2003 10:20:10 +0100 Subject: [python-win32] Re: win32 shell SHGetFileInfo? References: <3E186AE4.3000204@hpcs.com> Message-ID: Cody Pisto writes: > Is there any way to get at the win32 shell SHGetFileInfo call from the > win32all python modules? > > Im trying to get the associated icon for a file on win32, but I see > this function is not exposed via the win32com.shell shell module for > python. > > > Anyone have any other suggestions on how one might go about retrieving > the shell associated icons? > http://starship.python.net/crew/theller/ctypes.html Thomas From Jim.Vickroy@noaa.gov Mon Jan 6 15:44:08 2003 From: Jim.Vickroy@noaa.gov (Jim Vickroy) Date: Mon, 06 Jan 2003 08:44:08 -0700 Subject: [python-win32] Setting PYTHONSTARTUP References: <5.1.0.14.0.20021223220338.02416678@smtp.sbcglobal.net> <5.1.0.14.0.20030105222410.03dd9988@tcapp.com> Message-ID: <3E19A448.DCA75080@noaa.gov> Have you considered using the "Edit Python Path" option under the "Tools" menu to add the desired directory to the MSW Registry? Tony Cappellini wrote: > > >>Tony, I believe PYTHONSTARTUP is only used by the interactive > > **command** line > > >>interpreter; if you enter *python* on a command line, you should see > > your print > > >>statement. > > Ok- so how do I get PythonWin to cd into the directory where my scripts > are, when it is launched, so I dont have to do it manually each time ? > > >Tony Cappellini wrote: > > > > > I've added the PYTHONSTARTUP variable to control panel, on Win2000,and put > > > a print statement in the file, so I know IF it's being executed. > > > After launching PythonWin, I never see the print statement, nor the effects > > > from changing directories, which I've also added to the file pointed to by > > > PYTHONSTARTUP.. > > > > > > Strangely enough, neither IDLE, Ipython, nor PythonW32 see the startup > > > file, so what am I doing wrong ? > > > > > > thanks > > > > > > _______________________________________________ > > > Python-win32 mailing list > > > Python-win32@python.org > > > http://mail.python.org/mailman/listinfo/python-win32 From BTaylor@harlandfs.com Mon Jan 6 16:35:44 2003 From: BTaylor@harlandfs.com (Bill Taylor) Date: Mon, 6 Jan 2003 08:35:44 -0800 Subject: [python-win32] Process creation hang up - Part 2 Message-ID: <342DB6B3FE8BD5119D0F0090273C236431225F@EX_PORTLAND1> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C2B5A1.A8844CC0 Content-Type: text/plain; charset="iso-8859-1" Thanks Mark - this did the trick. -----Original Message----- From: Mark Hammond [mailto:mhammond@skippinet.com.au] Sent: Thursday, December 19, 2002 10:15 PM To: 'Bill Taylor'; python-win32@python.org Subject: RE: [python-win32] Process creation hang up - Part 2 It sounds like your Python app needs to be running the message pump (maybe as it is the "parent" of a DDE hosted app) - as soon as your Python script displays a UI (and therefore starts a loop) everything springs to life, so this sounds like the problem. First try a "busy" wait loop - ie: while 1: win32gui.PumpWaitingMessages() # check for result.txt, but dont wait if check(): break If that works, you can then work on a more efficient wait loop. Mark. -----Original Message----- From: python-win32-admin@python.org [mailto:python-win32-admin@python.org]On Behalf Of Bill Taylor Sent: Friday, 20 December 2002 7:09 AM To: 'python-win32@python.org' Subject: [python-win32] Process creation hang up - Part 2 I failed to give the complete scenario on this and also make clear a few other things. 1. This all begins with an MFC app launching my python scripts. So, again, the complete progression is: MFC app launches python scripts python scripts call program.exe program.exe calls login.exe login.exe presents login window to user user enters login info program.exe hangs python scripts timeout waiting for program.exe to write result.txt; python scripts present message window to user. program.exe "un-hangs"; writes result.txt 2. Program.exe and login.exe are third party apps in which I do not have access to that code. When program.exe is run as a stand alone app, it works fine, creating result.txt. Sorry for the omissions - thanks again for your suggestions. Bill -----Original Message----- From: Bill Taylor Sent: Wednesday, December 18, 2002 2:21 PM To: 'python-win32@python.org' Subject: Process creation hang up Hi all, Sorry this is lengthy and wordy... but does anyone have experience with process creation? I'm having problems with my child process hanging. Could be I'm a rookie (I am) missing the boat on something simple... or I'm just an idiot... or both (likely) :) Here's my scenario: I need to call an executable within my Python code - let's call this program.exe. Program.exe in turn calls a login executable - let's call this login.exe. Program.exe calls login.exe opening a DDE channel. Login.exe presents a login window to a user. The user enters user ID and password and then program.exe logs into a server database. Once connected, program.exe gathers database information and writes it to a text file named result.txt back on the calling machine. Here's my problem: When I use win32api.WinExec(programPathName), program.exe is called, login.exe is called, login window is presented to the user, user enters login information, and then program.exe hangs. Immediately after calling program.exe, my code goes into a time.sleep loop looking for result.exe. When result.exe is not found within a specified time, I present a message to the user to terminate. As soon as this message is presented, program.exe "un-hangs" and completes execution, writing result.txt to the calling machine. So, it appears my code has some sort of lock on the processor (possibly my time.sleep loop) preventing program.exe from processing. Any clues on this? Also, I've tried the os.spawn functions, win32api.ShellExecute, and win32process.CreateProcess with several different parameter settings on each and I get similar behavior except with all of these I don't get as far as with WinExec in that login.exe's login window never even displays. Here's my basic calls: Spawnl ================================================== os.spawnl(os.P_WAIT, programPathName) ================================================== ShellExecute ================================================== win32api.ShellExecute(0, None, programPathName, "", programPath, 1) ================================================== CreateProcess ================================================== si = win32process.STARTUPINFO() win32process.CreateProcess(None, # module programPathName, #command line None, #process security attributes None, #thread security attributes 0, #handle inheritance flag win32con.NORMAL_PRIORITY_CLASS, #creation flags None, # process new environment setting programPath, #start directory si) #STARTUPINFO object specifying window appearance ================================================== wait loop ================================================== while not os.path.exists(fileName) and wait < maxWait: wait += 1 time.sleep(1) if wait >= maxWait: #Timeout error message = "Cannot find file " + fileName + "\nDo you want to continue searching?" ret = DisplayMessageBox(message, "File Search Timeout Message", "YESNO") if ret == 1: wait = 0 else: #terminate ================================================== Any suggestions/help are/is much appreciated! Thanks in advance folks, Bill Taylor ------_=_NextPart_001_01C2B5A1.A8844CC0 Content-Type: text/html; charset="iso-8859-1"
Thanks Mark - this did the trick.
-----Original Message-----
From: Mark Hammond [mailto:mhammond@skippinet.com.au]
Sent: Thursday, December 19, 2002 10:15 PM
To: 'Bill Taylor'; python-win32@python.org
Subject: RE: [python-win32] Process creation hang up - Part 2

It sounds like your Python app needs to be running the message pump (maybe as it is the "parent" of a DDE hosted app) - as soon as your Python script displays a UI (and therefore starts a loop) everything springs to life, so this sounds like the problem.
 
First try a "busy" wait loop - ie:
 
while 1:
  win32gui.PumpWaitingMessages()
  # check for result.txt, but dont wait
  if check():
    break
 
If that works, you can then work on a more efficient wait loop.
 
Mark.
-----Original Message-----
From: python-win32-admin@python.org [mailto:python-win32-admin@python.org]On Behalf Of Bill Taylor
Sent: Friday, 20 December 2002 7:09 AM
To: 'python-win32@python.org'
Subject: [python-win32] Process creation hang up - Part 2

I failed to give the complete scenario on this and also make clear a few other things.
 
1. This all begins with an MFC app launching my python scripts.  So, again, the complete progression is:
MFC app launches python scripts
python scripts call program.exe
program.exe calls login.exe
login.exe presents login window to user
user enters login info
program.exe hangs
python scripts timeout waiting for program.exe to write result.txt; python scripts present message window to user.
program.exe "un-hangs"; writes result.txt
 
2. Program.exe and login.exe are third party apps in which I do not have access to that code.  When program.exe is run as a stand alone app, it works fine, creating result.txt.
 
Sorry for the omissions - thanks again for your suggestions.
 
Bill
-----Original Message-----
From: Bill Taylor
Sent: Wednesday, December 18, 2002 2:21 PM
To: 'python-win32@python.org'
Subject: Process creation hang up

Hi all,
 
Sorry this is lengthy and wordy... but does anyone have experience with process creation?  I'm having problems with my child process hanging.  Could be I'm a rookie (I am) missing the boat on something simple... or I'm just an idiot... or both (likely) :)
 
Here's my scenario:
I need to call an executable within my Python code - let's call this program.exe.  Program.exe in turn calls a login executable - let's call this login.exe.  Program.exe calls login.exe opening a DDE channel.  Login.exe presents a login window to a user.  The user enters user ID and password and then program.exe logs into a server database.  Once connected, program.exe gathers database information and writes it to a text file named result.txt back on the calling machine.
 
Here's my problem:
When I use win32api.WinExec(programPathName), program.exe is called, login.exe is called, login window is presented to the user, user enters login information, and then program.exe hangs.  Immediately after calling program.exe, my code goes into a time.sleep loop looking for result.exe.  When result.exe is not found within a specified time, I present a message to the user to terminate.  As soon as this message is presented, program.exe "un-hangs" and completes execution, writing result.txt to the calling machine.  So, it appears my code has some sort of lock on the processor (possibly my time.sleep loop) preventing program.exe from processing.  Any clues on this?
 
Also, I've tried the os.spawn functions, win32api.ShellExecute, and win32process.CreateProcess with several different parameter settings on each and I get similar behavior except with all of these I don't get as far as with WinExec in that login.exe's login window never even displays.  Here's my basic calls:
 
Spawnl
==================================================
os.spawnl(os.P_WAIT, programPathName)
==================================================
 
ShellExecute
==================================================
win32api.ShellExecute(0, None, programPathName, "", programPath, 1)
==================================================
 
CreateProcess
==================================================
si = win32process.STARTUPINFO()
win32process.CreateProcess(None, # module
                                           programPathName, #command line
                                           None, #process security attributes
                                           None, #thread security attributes
                                           0, #handle inheritance flag
                                           win32con.NORMAL_PRIORITY_CLASS, #creation flags
                                           None, # process new environment setting
                                           programPath, #start directory
                                           si) #STARTUPINFO object specifying window appearance
==================================================
 
wait loop
==================================================
while not os.path.exists(fileName) and wait < maxWait:
        wait += 1
        time.sleep(1)
            
        if wait >= maxWait:
            #Timeout error
            message = "Cannot find file " + fileName + "\nDo you want to continue searching?"
            ret = DisplayMessageBox(message, "File Search Timeout Message", "YESNO")
            if ret == 1:
                wait = 0
            else:
                #terminate
==================================================
 
Any suggestions/help are/is much appreciated!

Thanks in advance folks,

Bill Taylor

------_=_NextPart_001_01C2B5A1.A8844CC0-- From aeo120@psu.edu Mon Jan 6 18:05:03 2003 From: aeo120@psu.edu (Andy Osagie) Date: Mon, 6 Jan 2003 13:05:03 -0500 Subject: [python-win32] Creating a screenshot.. Message-ID: <000101c2b5ae$38a7e760$7ac8a9ac@aeo120> This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C2B584.4FD1DF60 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello. I was wondering how to create a screenshot of the user's screen and return that data into a variable. I was told to look into the python win32 extensions and I did. The only idea I could come up with for accomplishing my goal was the following: win32api.keybd_event(win32con.VK_PRINT, 0) win32clipboard.OpenClipboard(0) data = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP) win32clipboard.CloseClipboard() This, unfortunately, didn't work for two reasons. First: the first line didn't successful recreate the act of the user pressing down the "Print Screen" button. Pressing this down would have taken a screenshot of the screen in bitmap format and pasted it to the clipboard. Second: I get a "NotImplementedError" on line 3. Apparently "GetClipboardData" doesn't work with the BITMAP type yet? :-( Are there any suggestions on alternate ways to accomplish my goal? Thanks in advance. -- Andy ------=_NextPart_000_0002_01C2B584.4FD1DF60 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hello.

I was wondering how to create a screenshot of the user’s screen and return that data into a variable. I was told to = look into the python win32 extensions and I did. The only idea I could come = up with for accomplishing my goal was the following:

 

win32api.keybd_event(win32con.VK_PRIN= T, 0)

win32clipboard.OpenClipboard(0)

data =3D win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP)

win32clipboard.CloseClipboard()

 

This, unfortunately, didn’t work for two = reasons. First: the first line didn’t successful recreate the act of the = user pressing down the “Print Screen” button. Pressing this down = would have taken a screenshot of the screen in bitmap format and pasted it to = the clipboard. Second: I get a “NotImplementedError” on line 3. Apparently “GetClipboardData” doesn’t work with the = BITMAP type yet? L

 

Are there any suggestions on alternate ways to = accomplish my goal? Thanks in advance.

 

-- Andy

 

 

------=_NextPart_000_0002_01C2B584.4FD1DF60-- From mhammond@skippinet.com.au Mon Jan 6 23:49:21 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:49:21 +1100 Subject: [python-win32] number of arguments to CreateControl In-Reply-To: <20021228115119.96289.qmail@web40807.mail.yahoo.com> Message-ID: <00f101c2b5de$3cafb330$530f8490@eden> > i wonder if it would be okay (ie, not break anything), > to make a v small change to activex.py: Yep - I added it here. > however, i cannot verify it actually does anything. i > have an activex control that requires a license string > that will work fine without one under pythonwin, but i > cant get it to work at all (even with the license > string) under straight console python (it shows me a > win32ui module message box that says the control could > not be created.) has anyone seen something like this > before? console python does not have the AXControl framework in place - code that uses MFC often needs to run under pythonwin.exe Mark. From mhammond@skippinet.com.au Mon Jan 6 23:53:11 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:53:11 +1100 Subject: [python-win32] main loop? In-Reply-To: <3E151A37.5070302@holly-springs.nc.us> Message-ID: <00f901c2b5de$c68a6140$530f8490@eden> > Is there something like glib's main loop available for use > with Python? This depends on the GUI toolkit and/or exactly what you want to do. win32gui.PumpWaitingMessages() or PumpMessages() does run a message loop, but that may or may not be what you are after. Mark. From mhammond@skippinet.com.au Mon Jan 6 23:54:08 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:54:08 +1100 Subject: [python-win32] win32 shell SHGetFileInfo? In-Reply-To: <3E186AE4.3000204@hpcs.com> Message-ID: <00fa01c2b5de$e79f0200$530f8490@eden> > Is there any way to get at the win32 shell SHGetFileInfo call > from the > win32all python modules? > Im trying to get the associated icon for a file on win32, but > I see this > function is not exposed via the win32com.shell shell module > for python. see the win32comext\shell\test directory. Mark. From mhammond@skippinet.com.au Mon Jan 6 23:40:10 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:40:10 +1100 Subject: [python-win32] Python Win32 build 150- bottom lines not visible when window is not maximized In-Reply-To: <5.1.0.14.0.20021221230833.00b14ce8@smtp.sbcglobal.net> Message-ID: <00eb01c2b5dc$f509adc0$530f8490@eden> > I'm using build 150 on a WIn32 machine. > If the Python Win32 IDE is not maximized, you cannot see that > last few lines. Last few lines of what? > Also, when I type a module name, followed by a '.', and let > the command > line completion window be displayed, the dropdown box is not > fully displayed. I see this too :( Mark. From mhammond@skippinet.com.au Mon Jan 6 23:46:19 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:46:19 +1100 Subject: [python-win32] ASP, Python 2.2 In-Reply-To: <3E0B800A.2030305@holly-springs.nc.us> Message-ID: <00ef01c2b5dd$d0180470$530f8490@eden> > 1) sys.path doesn't include the current directory > I cannot import a module in the local directory of the ASP > script unless > I first sys.path.append() the current directory. There is no concept of "cwd" in ASP. Indeed, Python does not even know the filename from where the script code came from (if indeed it did come from a file at all!) You can add your directory to sys.path using any of the various techniques supported by Python itself. > 2) page displays once, then doesn't display again. > The first time a access an ASP page from a browser, it runs > properly and > displays the contents I would expect. The second time, it > doesn't return > anything but this: As Don said, upgrade win32all for this. Mark. From mhammond@skippinet.com.au Mon Jan 6 23:51:14 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:51:14 +1100 Subject: [python-win32] [Newbie] win32service.OpenService... In-Reply-To: <6995CDA63A54D511B8B80006291686FB28A810@ISI01> Message-ID: <00f801c2b5de$803e9f30$530f8490@eden> > Where can I find the values acceptable for the > 'DesiredAccess' arguement? In the MS documentation for the specific function you are interested in. msdn.microsoft.com Mark. From forestiero@qwest.net Tue Jan 7 01:15:45 2003 From: forestiero@qwest.net (DogWalker) Date: Mon, 6 Jan 2003 17:15:45 -0800 Subject: [python-win32] Setting PYTHONSTARTUP References: <5.1.0.14.0.20021223220338.02416678@smtp.sbcglobal.net> <5.1.0.14.0.20030105222410.03dd9988@tcapp.com> Message-ID: <018b01c2b5ea$50b1cec0$639a0043@presario> Create a shortcut to the pythonwin executable with your script directory in the Start In item? ----- Original Message ----- From: "Tony Cappellini" To: "Jim Vickroy" Cc: Sent: Sunday, January 05, 2003 10:25 PM Subject: Re: [python-win32] Setting PYTHONSTARTUP > > > >>Tony, I believe PYTHONSTARTUP is only used by the interactive > > **command** line > > >>interpreter; if you enter *python* on a command line, you should see > > your print > > >>statement. > > Ok- so how do I get PythonWin to cd into the directory where my scripts > are, when it is launched, so I dont have to do it manually each time ? > > > > >Tony Cappellini wrote: > > > > > I've added the PYTHONSTARTUP variable to control panel, on Win2000,and put > > > a print statement in the file, so I know IF it's being executed. > > > After launching PythonWin, I never see the print statement, nor the effects > > > from changing directories, which I've also added to the file pointed to by > > > PYTHONSTARTUP.. > > > > > > Strangely enough, neither IDLE, Ipython, nor PythonW32 see the startup > > > file, so what am I doing wrong ? > > > > > > thanks > > > > > > _______________________________________________ > > > Python-win32 mailing list > > > Python-win32@python.org > > > http://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From forestiero@qwest.net Tue Jan 7 01:43:52 2003 From: forestiero@qwest.net (DogWalker) Date: Mon, 6 Jan 2003 17:43:52 -0800 Subject: [python-win32] Creating a screenshot.. References: <000101c2b5ae$38a7e760$7ac8a9ac@aeo120> Message-ID: <019801c2b5ee$3e25be20$639a0043@presario> This is a multi-part message in MIME format. ------=_NextPart_000_0194_01C2B5AB.2DA7C540 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit When I pressed the PrtScrn button on my keyboard, I found a CF_DIB on the Clipboard. I used the Clipspy program to determine the type of data on the Clipboard. Clipspy is available here: http://home.inreach.com/mdunn/code/ ----- Original Message ----- From: Andy Osagie To: python-win32@python.org Sent: Monday, January 06, 2003 10:05 AM Subject: [python-win32] Creating a screenshot.. Hello. I was wondering how to create a screenshot of the user's screen and return that data into a variable. I was told to look into the python win32 extensions and I did. The only idea I could come up with for accomplishing my goal was the following: win32api.keybd_event(win32con.VK_PRINT, 0) win32clipboard.OpenClipboard(0) data = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP) win32clipboard.CloseClipboard() This, unfortunately, didn't work for two reasons. First: the first line didn't successful recreate the act of the user pressing down the "Print Screen" button. Pressing this down would have taken a screenshot of the screen in bitmap format and pasted it to the clipboard. Second: I get a "NotImplementedError" on line 3. Apparently "GetClipboardData" doesn't work with the BITMAP type yet? L Are there any suggestions on alternate ways to accomplish my goal? Thanks in advance. -- Andy ------=_NextPart_000_0194_01C2B5AB.2DA7C540 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
When I pressed the PrtScrn button on = my=20 keyboard, I found a CF_DIB on the Clipboard. I used the Clipspy program = to=20 determine the type of data on the Clipboard. Clipspy is available here: = http://home.inreach.com/mdun= n/code/
----- Original Message -----
From:=20 Andy = Osagie
Sent: Monday, January 06, 2003 = 10:05=20 AM
Subject: [python-win32] = Creating a=20 screenshot..

Hello.

I was wondering how to = create a=20 screenshot of the user=92s screen and return that data into a = variable. I was=20 told to look into the python win32 extensions and I did. The only idea = I could=20 come up with for accomplishing my goal was the = following:

 

win32api.keybd_event(win32con.VK_PRINT,=20 0)

win32clipboard.OpenClipboard(0)

data = =3D=20 = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP)

win32clipboard.CloseClipboard()

 

This, unfortunately, = didn=92t work=20 for two reasons. First: the first line didn=92t successful recreate = the act of=20 the user pressing down the =93Print Screen=94 button. Pressing this = down would=20 have taken a screenshot of the screen in bitmap format and pasted it = to the=20 clipboard. Second: I get a =93NotImplementedError=94 on line 3. = Apparently=20 =93GetClipboardData=94 doesn=92t work with the BITMAP type yet? = L

 

Are there any = suggestions on=20 alternate ways to accomplish my goal? Thanks in = advance.

 

-- = Andy

 

 

------=_NextPart_000_0194_01C2B5AB.2DA7C540-- From tony@tcapp.com Tue Jan 7 07:27:58 2003 From: tony@tcapp.com (Tony Cappellini) Date: Mon, 06 Jan 2003 23:27:58 -0800 Subject: [python-win32] Python Win32 build 150- bottom lines not visible when window is not maximized In-Reply-To: <00eb01c2b5dc$f509adc0$530f8490@eden> References: <5.1.0.14.0.20021221230833.00b14ce8@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20030106230944.048acc40@tcapp.com> > > I'm using build 150 on a WIn32 machine. > > If the Python Win32 IDE is not maximized, you cannot see that > > last few lines. > > >>Last few lines of what? of what was displayed in PythonWin. > > Also, when I type a module name, followed by a '.', and let > > the command > > line completion window be displayed, the dropdown box is not > > fully displayed. > > >>I see this too :( I'm glad it's not just me. Seems like I"m the only one having IDE problems. I went to small fonts, and I can't seem to duplicate that problem I posted B4, so it ooks like it may have been the large fonts. Is there any way to easily make your IDE work with both large & small fonts ? >Mark. From wzhang@ic.sunysb.edu Tue Jan 7 15:23:39 2003 From: wzhang@ic.sunysb.edu (WZhang) Date: Tue, 7 Jan 2003 10:23:39 -0500 (EST) Subject: [python-win32] COM (ActiveX) problem Message-ID: I am trying to work with a frame Grabber card (coreco tci serie) in my computer. It come with activeX control tcictrl.ocx, tcictrl.tbl. The activeX control works fine when called by labview. I am trying to write progrem in python to talk with the card. I find a nice utility call "oleview" from Microsoft to browser the COMs(you can see the ProgID, and detail of each typelib, I did not see anyone mention it in the list and a lot of people have trouble finding the COMs in their computer, hope this helps). I can Dispatch the activeX control with no problem. tci=win32com.client.Dispatch("TCICtrl.TCICtrlCtrl.1") But after that every function I try to call generate error: for example tci.AboutBox() will generate "Unexpected error", why is that. Another question is, I am doing the GUI using wxpython, I am not sure how to make the video (if I could make the activex works) show in my gui. Thanks Wenhua From mhammond@skippinet.com.au Wed Jan 8 00:00:39 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Wed, 8 Jan 2003 11:00:39 +1100 Subject: [python-win32] COM (ActiveX) problem In-Reply-To: Message-ID: <023201c2b6a8$fb142e80$530f8490@eden> You will probably find that your OCX truly requires an OXC control host. Both wxPython and Pythonwin are capable of doing this, but (w)python.exe is not. I suggest you look in the pywin\demos\ocx directory, and see if you can make Pythonwin host your OCX. If you can, next try wxPython - find their OCX samples too. Mark. > -----Original Message----- > From: python-win32-admin@python.org > [mailto:python-win32-admin@python.org]On Behalf Of WZhang > Sent: Wednesday, 8 January 2003 2:24 AM > To: python-win32@python.org > Subject: [python-win32] COM (ActiveX) problem > > > I am trying to work with a frame Grabber card (coreco tci serie) in my > computer. It come with activeX control tcictrl.ocx, tcictrl.tbl. The > activeX control works fine when called by labview. I am > trying to write > progrem in python to talk with the card. I find a nice utility call > "oleview" from Microsoft to browser the COMs(you can see the > ProgID, and > detail of each typelib, I did not see anyone mention it in > the list and a > lot of people have trouble finding the COMs in their > computer, hope this > helps). > > I can Dispatch the activeX control with no problem. > > tci=win32com.client.Dispatch("TCICtrl.TCICtrlCtrl.1") > > But after that every function I try to call generate error: > > for example > > tci.AboutBox() > > will generate "Unexpected error", why is that. > > > Another question is, I am doing the GUI using wxpython, I am > not sure how > to make the video (if I could make the activex works) show in my gui. > > Thanks > > > Wenhua > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond@skippinet.com.au Tue Jan 7 10:25:26 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 21:25:26 +1100 Subject: [python-win32] Python Win32 build 150- bottom lines not visible when window is not maximized In-Reply-To: <5.1.0.14.0.20030106230944.048acc40@tcapp.com> Message-ID: <018501c2b637$19035320$530f8490@eden> > > > I'm using build 150 on a WIn32 machine. > > > If the Python Win32 IDE is not maximized, you cannot see that > > > last few lines. > > > > >>Last few lines of what? > > of what was displayed in PythonWin. I'm not sure what you mean. If the "interactive" window, I don't see this, as it is always 4 lines long when Pythonwin starts, and afterwards scrolls normally. The scintilla popup windows behave strangely, which is what you describe below. Dockng it smaller than 4 lines may get even stranger - in which case "don't do that" (tm) > > > Also, when I type a module name, followed by a '.', and let > > > the command > > > line completion window be displayed, the dropdown box is not > > > fully displayed. > > > > >>I see this too :( > > I'm glad it's not just me. Seems like I"m the only one having > IDE problems. > I went to small fonts, and I can't seem to duplicate that > problem I posted > B4, so it ooks like it may have been the large fonts. > > Is there any way to easily make your IDE work with both large > & small fonts ? It would seem not. I'm still not clear on what large-font versus small-font specific issues exist, but even if I was, fixing them wouldn't be at the top of my list. If-only-I-had-a-list-ly, Mark. From mhammond@skippinet.com.au Mon Jan 6 23:57:11 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 7 Jan 2003 10:57:11 +1100 Subject: [python-win32] Creating a screenshot.. In-Reply-To: <000101c2b5ae$38a7e760$7ac8a9ac@aeo120> Message-ID: <00fc01c2b5df$54fc71c0$530f8490@eden> This is a multi-part message in MIME format. ------=_NextPart_000_00FD_01C2B63B.886CE9C0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I would also look at PIL from www.pythonware.com - that may have a way of grabbing the screen into an image. Later versions of win32all work with more clipboard formats, and generally allow you to specify the bimary data even when the format is not directly recognised. Mark. -----Original Message----- From: python-win32-admin@python.org [mailto:python-win32-admin@python.org]On Behalf Of Andy Osagie Sent: Tuesday, 7 January 2003 5:05 AM To: python-win32@python.org Subject: [python-win32] Creating a screenshot.. Hello. I was wondering how to create a screenshot of the user's screen and return that data into a variable. I was told to look into the python win32 extensions and I did. The only idea I could come up with for accomplishing my goal was the following: win32api.keybd_event(win32con.VK_PRINT, 0) win32clipboard.OpenClipboard(0) data = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP) win32clipboard.CloseClipboard() This, unfortunately, didn't work for two reasons. First: the first line didn't successful recreate the act of the user pressing down the "Print Screen" button. Pressing this down would have taken a screenshot of the screen in bitmap format and pasted it to the clipboard. Second: I get a "NotImplementedError" on line 3. Apparently "GetClipboardData" doesn't work with the BITMAP type yet? L Are there any suggestions on alternate ways to accomplish my goal? Thanks in advance. -- Andy ------=_NextPart_000_00FD_01C2B63B.886CE9C0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
I=20 would also look at PIL from www.pythonware.com - that may = have a way of=20 grabbing the screen into an image.
 
Later=20 versions of win32all work with more clipboard formats, and generally = allow you=20 to specify the bimary data even when the format is not directly=20 recognised.
 
Mark.
-----Original Message-----
From:=20 python-win32-admin@python.org = [mailto:python-win32-admin@python.org]On=20 Behalf Of Andy Osagie
Sent: Tuesday, 7 January 2003 5:05 = AM
To: python-win32@python.org
Subject: = [python-win32]=20 Creating a screenshot..

Hello.

I was wondering how to = create a=20 screenshot of the user’s screen and return that data into a = variable. I was=20 told to look into the python win32 extensions and I did. The only idea = I could=20 come up with for accomplishing my goal was the = following:

 

win32api.keybd_event(win32con.VK_PRINT,=20 0)

win32clipboard.OpenClipboard(0)

data = =3D=20 = win32clipboard.GetClipboardData(win32clipboard.CF_BITMAP)

win32clipboard.CloseClipboard()

 

This, unfortunately, = didn’t work=20 for two reasons. First: the first line didn’t successful = recreate the act of=20 the user pressing down the “Print Screen” button. Pressing = this down would=20 have taken a screenshot of the screen in bitmap format and pasted it = to the=20 clipboard. Second: I get a “NotImplementedError” on line = 3. Apparently=20 “GetClipboardData” doesn’t work with the BITMAP type = yet? L

 

Are there any = suggestions on=20 alternate ways to accomplish my goal? Thanks in = advance.

 

-- = Andy

 

 

------=_NextPart_000_00FD_01C2B63B.886CE9C0-- From Jim Abrams Tue Jan 7 22:33:57 2003 From: Jim Abrams (Jim Abrams) Date: Tue, 7 Jan 2003 17:33:57 -0500 Subject: [python-win32] 2 ASP Things Message-ID: <925614101.20030107173357@publishingresources.com> 1. Was that strange KeyboardInterrupt Error killed yet? 2. If you are using that string Interpolation module, Itpl.py, remember it's not thread safe and therefore not safe for ASP. --- Jim Abrams From tony@tcapp.com Wed Jan 8 07:21:08 2003 From: tony@tcapp.com (Tony Cappellini) Date: Tue, 07 Jan 2003 23:21:08 -0800 Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations Message-ID: <5.1.0.14.0.20030107231453.0458b890@smtp.sbcglobal.net> I'm using WIn32all Build 152. After editing a module, saveing the changes, and clicking Import/Reload, Pywin only sees the module before the edit was made . It wont reload the module, which actually has the fix. It's like it's caching the old code, or only executing the old pyc file, and not acknowledging that the source file was changed. It's weird, I can edit, save execute about 10 times or so, after that, no changes get recompiled, until I exit PythonWin. I saw this in Build 150 as well, and was hoping it had been fixed. Both times, this happened on Win2k. Haven't tried it on Win 98 yet. Has anyone else seen this ? Tony From robinjim@earthlink.net Wed Jan 8 10:31:26 2003 From: robinjim@earthlink.net (robin and jim) Date: Wed, 8 Jan 2003 03:31:26 -0700 Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations References: <5.1.0.14.0.20030107231453.0458b890@smtp.sbcglobal.net> Message-ID: <001101c2b701$1a6f3060$b1f7d33f@robinjim> ----- Original Message ----- From: "Tony Cappellini" To: Sent: Wednesday, January 08, 2003 12:21 AM Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations > > > I'm using WIn32all Build 152. > After editing a module, saveing the changes, and clicking Import/Reload, > Pywin only sees the module before the edit was made . > It wont reload the module, which actually has the fix. It's like it's > caching the old code, or only executing the old pyc file, and not > acknowledging that the source file was changed. > > It's weird, I can edit, save execute about 10 times or so, after that, no > changes get recompiled, until I exit PythonWin. > > I saw this in Build 150 as well, and was hoping it had been fixed. Did you report this as a possible problem? Have you considered investigating the problem and submitting a patch to Mark? > > Both times, this happened on Win2k. Haven't tried it on Win 98 yet. > > > > Has anyone else seen this ? > > Tony > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From tony@tcapp.com Wed Jan 8 16:36:15 2003 From: tony@tcapp.com (Tony Cappellini) Date: Wed, 08 Jan 2003 08:36:15 -0800 Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations In-Reply-To: <001101c2b701$1a6f3060$b1f7d33f@robinjim> References: <5.1.0.14.0.20030107231453.0458b890@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20030108083515.044f69b0@tcapp.com> > > >>Did you report this as a possible problem? Yes. > >>Have you considered investigating the problem and submitting a patch to I dont know enough about Python yet Tony From markh@skippinet.com.au Wed Jan 8 23:56:46 2003 From: markh@skippinet.com.au (Mark Hammond) Date: Thu, 9 Jan 2003 10:56:46 +1100 Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations In-Reply-To: <5.1.0.14.0.20030107231453.0458b890@smtp.sbcglobal.net> Message-ID: <006c01c2b771$9baa6c60$530f8490@eden> > I'm using WIn32all Build 152. > After editing a module, saveing the changes, and clicking > Import/Reload, > Pywin only sees the module before the edit was made . > It wont reload the module, which actually has the fix. It's like it's > caching the old code, or only executing the old pyc file, and not > acknowledging that the source file was changed. > > It's weird, I can edit, save execute about 10 times or so, > after that, no > changes get recompiled, until I exit PythonWin. No one else has ever reported this. Does your module use classes? Also, check out the status bar after the import - the name of the module that was imported is displayed. In some strange cases, Pythonwin may get confused. Eg, if the cwd of Pythonwin changes, then Pythonwin may decide the module is now a sub-module in a package, or something wierd like that. So check the module name displayed when it does work, and compare it to the module name when it does not. Mark. From tony@tcapp.com Thu Jan 9 06:47:45 2003 From: tony@tcapp.com (Tony Cappellini) Date: Wed, 08 Jan 2003 22:47:45 -0800 Subject: [python-win32] PythonWin - wont reload or import modules- after (approx) 10 recompilations In-Reply-To: <006c01c2b771$9baa6c60$530f8490@eden> References: <5.1.0.14.0.20030107231453.0458b890@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20030108224401.01aa1928@tcapp.com> >>No one else has ever reported this. actually I did- to this list, back when I was using build 150. I event got some mail from you about it. >>Does your module use classes? My module only has 1 class, a very simple "hello world" kinda class- I'm just now learning about python classes I know you're going to tell me that I need to re-instantiate the class, after reloading/re-importing the module, which I carefully did, many times I'm sure it wasn't a directory or path issue- there's only one file with this name & class in it. > >>that was imported is displayed. In some strange cases, Pythonwin may get will have to look at that next time. > >>So check the module name displayed when it does work, and compare it to the > >>module name when it does not. Will try it now to see what happens. tony From itamarst@yahoo.com Sun Jan 12 00:23:48 2003 From: itamarst@yahoo.com (Itamar S.-T.) Date: Sat, 11 Jan 2003 16:23:48 -0800 (PST) Subject: [python-win32] main loop? In-Reply-To: <00f901c2b5de$c68a6140$530f8490@eden> Message-ID: <20030112002348.43590.qmail@web40801.mail.yahoo.com> --- Mark Hammond wrote: > > Is there something like glib's main loop available > for use > > with Python? > > This depends on the GUI toolkit and/or exactly what > you want to do. > win32gui.PumpWaitingMessages() or PumpMessages() > does run a message loop, > but that may or may not be what you are after. Twisted has a pluggable event loop that supports GTK+ (and thus glib), Win32 event loop, and a few more as well, all with a high level interface so you can choose which to use at runtime. http://www.twistedmatrix.com ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From smeds@pdc.kth.se Sun Jan 12 21:21:30 2003 From: smeds@pdc.kth.se (Nils Smeds) Date: Sun, 12 Jan 2003 21:21:30 +0000 Subject: [python-win32] CreateFileDialog insufficient buffer size Message-ID: <5.1.0.14.2.20030112211533.009f2af0@localhost> Hi, I have run into the same problem as described in http://mail.python.org/pipermail/python-list/2002-July/113933.html by Thomas H=FCbner (originally) and Richie Hindle (who diagnosed it). I am curious if it is on anyone's todo-list to work around this problem where the DoModal() fails as the file names selected in the dialog box are so many that the internal buffer in MFC is insufficient to hold them all. (This I expect is only likely to happen when win32con.OFN_ALLOWMULTISELECT has been stated among the flags to CreateFileDialog.) The only thing I've been able to so far is to conclude that DoModal() returns the value 2 when the buffer is insufficient so at least it is possible to detect in the application. But it would be great if the win32ui automatically reallocated the buffer to the right size as described in http://support.microsoft.com/directory/article.asp?ID=3DKB;EN-US;Q131462 On a side issue: Is it possible to use the CreateFileDialog to get a Folder selected by the user. That is, can I pass a filter value into CreateFileDialog() so that the user is only able to specify his/her folder of interest and not a particular file? Many thanks in advance, /Nils=20 From mhammond@skippinet.com.au Sun Jan 12 23:09:05 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Mon, 13 Jan 2003 10:09:05 +1100 Subject: [python-win32] CreateFileDialog insufficient buffer size In-Reply-To: <5.1.0.14.2.20030112211533.009f2af0@localhost> Message-ID: <073401c2ba8f$9aee18a0$530f8490@eden> > The only thing I've been able to so far is to conclude that > DoModal() returns the value 2 when the buffer is insufficient > so at least it is possible to detect in the application. But > it would be great if the win32ui automatically reallocated > the buffer to the right size as described in > http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q131462 I would welcome a patch. > On a side issue: > > Is it possible to use the CreateFileDialog to get a Folder selected > by the user. That is, can I pass a filter value into > CreateFileDialog() > so that the user is only able to specify his/her folder of interest > and not a particular file? Use win32com.shell.shell.SHBrowseForFolder() Mark. From dond@advancedmp.com Wed Jan 15 01:35:16 2003 From: dond@advancedmp.com (Don Dwiggins) Date: 14 Jan 2003 17:35:16 -0800 Subject: [python-win32] Question on server architecture Message-ID: I have an architectural question: Background: I currently have a program that handles long-running requests on behalf of web clients. Essentially, the flow is: 1) The client (an ASP page) fires up an instance of the program, with arguments to begin the request processing (which will store its results in a database). 2) Subsequent requests "ping" the program to determine the status of the processing. 3) When the return is "finished", a redirect is done to query the database and format the results for the initiating user. (I've glossed over several details of the requestors, which aren't important here.) Currently, the whole thing is tied together by a generated token I call a "session ID" (nothing to do with ASP sessions). The program, on startup, creates a named pipe whose name includes the ID; the ping requests "call" the program using the pipe. This works, but it's proving to be less than ideal for a few reasons: - If a few requests come in at once, the processor load spikes; it can take several seconds for the program to get going. - Also, the ping requests seem to have a heavier impact than I'd thought. - In addition to web requests, I'm using as a client a scheduled process, run by the Cygwin cron daemon. This means that the process runs under the LocalSystem account, which oddly enough can't use named pipes (which must have names in a UNC format, which LocalSystem doesn't have access to). For this reason, I have to use a different scheduler started up under a logged-in user account. Oddly enough, when I ran stress tests on this setup, it was able to handle many simultaneous requests. The difference is that the stress test was using anonymous web clients, while in production the site uses integrated authentication. I'm not sure why this should make a difference, but it does. The result is long wait and execution times for the ASP requests. Question: I'm thinking of replacing the per-request process by a long-running process that takes requests by registering itself as a COM server. The problem is, I'm not sure that this approach will work. The idea is that the client would instantiate an object to make the initial request, then dismiss the object. The ping requests would operate similarly. Thus, between requests, the server would continue (presumably in different threads) running the request processes. Can anyone give insight as to whether this can/can't work? (I'll probably experiment with it, so I may have more to say if anyone's interested.) If you've gotten this far, thanks for your attention and any good words... -- Don Dwiggins "The truth will make you free, d.l.dwiggins@computer.org but first it will make you miserable" -- Tom DeMarco From jens.jorgensen@tallan.com Wed Jan 15 16:31:23 2003 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Wed, 15 Jan 2003 10:31:23 -0600 Subject: [python-win32] Question on server architecture In-Reply-To: References: Message-ID: <3E258CDB.3070200@tallan.com> Using a COM service exe would certainly have the advantage of getting rid of the process startup overhead. This can be a very convenient way to do things. I like the approach. I've written a system with similar properties that used a COM exe service that had threads doing the real work while COM object method calls were used to manipulate the process, get results, etc. In my case the system was written in c++ but the essence is the same and there's no reason you couldn't do it in Python I can think of. Anyhow the main thing you'll need to watch out for with this approach is the the COM SCM will want to create separate processes for requests coming from different users. That is, as you say you're using integrated authentication so the process is impersonating the authenticated user. When the client code goes to create an instance of the object (or more specifically calls CoGetClassObject) the COM SCM looks to see if there is already a class object registered for the one you're asking for. It matches on the CLSID but *also* checks to see if it has compatible security to the caller. If no explicity access control is set this means that if the user the process is running as is not the same as the user that is making the request this this fails. With a non-NT-Service COM server the SCM would just merrily create a new, separate process to service the request running as the same user as the requestor. IIRC though if it is a service it won't start a new process and will instead just fail. There are APIs though that you can call to explicitly set security access for your object and you'll probably need to do this. Now, that said, there are some interesting wrinkles most of which I don't clearly remember the details but they are there nonetheless. When IIS starts a process that impersonates a user it isn't the same as a real process started by that user say, on the desktop. I think this applies to requests which go over the network but would also think this would apply to inter-process requests on the same machine but perhaps not. This stuff all gets down to the details of security delegation. In our case the client requests did not originate from IIS so we didn't really have to deal with this. I'd be happy to field any questions you come up with on this and I'll try to answer as best I can. Don Dwiggins wrote: >I have an architectural question: > >Background: >I currently have a program that handles long-running requests on behalf of >web clients. Essentially, the flow is: > >1) The client (an ASP page) fires up an instance of the program, with > arguments to begin the request processing (which will store its results > in a database). > >2) Subsequent requests "ping" the program to determine the status of the > processing. > >3) When the return is "finished", a redirect is done to query the database > and format the results for the initiating user. > >(I've glossed over several details of the requestors, which aren't important >here.) > >Currently, the whole thing is tied together by a generated token I call a >"session ID" (nothing to do with ASP sessions). The program, on startup, >creates a named pipe whose name includes the ID; the ping requests "call" >the program using the pipe. > >This works, but it's proving to be less than ideal for a few reasons: >- If a few requests come in at once, the processor load spikes; it can take > several seconds for the program to get going. >- Also, the ping requests seem to have a heavier impact than I'd thought. >- In addition to web requests, I'm using as a client a scheduled process, > run by the Cygwin cron daemon. This means that the process runs under the > LocalSystem account, which oddly enough can't use named pipes (which must > have names in a UNC format, which LocalSystem doesn't have access to). > For this reason, I have to use a different scheduler started up under a > logged-in user account. > >Oddly enough, when I ran stress tests on this setup, it was able to handle >many simultaneous requests. The difference is that the stress test was >using anonymous web clients, while in production the site uses integrated >authentication. I'm not sure why this should make a difference, but it >does. The result is long wait and execution times for the ASP requests. > > >Question: >I'm thinking of replacing the per-request process by a long-running process >that takes requests by registering itself as a COM server. The problem is, >I'm not sure that this approach will work. The idea is that the client >would instantiate an object to make the initial request, then dismiss the >object. The ping requests would operate similarly. Thus, between requests, >the server would continue (presumably in different threads) running the >request processes. Can anyone give insight as to whether this can/can't >work? (I'll probably experiment with it, so I may have more to say if >anyone's interested.) > >If you've gotten this far, thanks for your attention and any good words... > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From mhammond@skippinet.com.au Wed Jan 15 23:31:56 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Thu, 16 Jan 2003 10:31:56 +1100 Subject: [python-win32] Question on server architecture In-Reply-To: Message-ID: <0a0901c2bcee$4d683af0$530f8490@eden> [Don] > Oddly enough, when I ran stress tests on this setup, it was > able to handle > many simultaneous requests. The difference is that the > stress test was > using anonymous web clients, while in production the site > uses integrated > authentication. I'm not sure why this should make a > difference, but it > does. The result is long wait and execution times for the > ASP requests. This is odd, and may be worth trying to track down. > Question: > I'm thinking of replacing the per-request process by a > long-running process > that takes requests by registering itself as a COM server. > The problem is, > I'm not sure that this approach will work. The idea is that > the client > would instantiate an object to make the initial request, then > dismiss the > object. The ping requests would operate similarly. Thus, > between requests, > the server would continue (presumably in different threads) > running the > request processes. Can anyone give insight as to whether > this can/can't > work? (I'll probably experiment with it, so I may have more to say if > anyone's interested.) This is likely to work fine. ASP will never actually unload Python, so a long-lived server may not even need to be an issue - if your COM object uses a module global to keep the state, then each new instance should be able to efficiently reuse whatever you need. This will only work if you have an InProc server. As Jens mentions, you may also be able to exploit an out-of-process COM object to give you some alternative advantages. Mark. From dond@advancedmp.com Thu Jan 16 01:52:01 2003 From: dond@advancedmp.com (Don Dwiggins) Date: 15 Jan 2003 17:52:01 -0800 Subject: [python-win32] Re: Question on server architecture References: <0a0901c2bcee$4d683af0$530f8490@eden> Message-ID: Mark Hammond writes: > [Don] >> Oddly enough, when I ran stress tests on this setup, it was >> able to handle >> many simultaneous requests. The difference is that the >> stress test was >> using anonymous web clients, while in production the site >> uses integrated >> authentication. I'm not sure why this should make a >> difference, but it >> does. The result is long wait and execution times for the >> ASP requests. > This is odd, and may be worth trying to track down. I've been trying desperately to do just that, with little success. Since the behavior is intermittent, it's been hard to find a "smoking gun". Actually, the difference I cited is only my best guess as to why it should happen. I'm basically giving up on trying to diagnose it, and am looking to use a different setup, one which should at least exhibit different behavior, and ideally will work more smoothly. Thanks for the help and the concern, though. -- Don Dwiggins "The truth will make you free, d.l.dwiggins@computer.org but first it will make you miserable" -- Tom DeMarco From wzhang@ic.sunysb.edu Thu Jan 16 16:10:44 2003 From: wzhang@ic.sunysb.edu (WZhang) Date: Thu, 16 Jan 2003 11:10:44 -0500 (EST) Subject: [python-win32] COM problem with array type conversion Message-ID: When I try to call a function in a COM object image by image.ImageToArray() or image.ImageToArray(0, 0, image.Width, image.Height) I always only get the first row as binary string, all the other rows are missing. I can work around it by: ims='' for x in range(image.Height): ims+=image.ImageToArray(0,x,image.Width, 1) But it become much slower for and 500x500 image. Looks to me the problem is: win32com have trouble convert a 2d binary array variant to the right python type. the detail of the com function is this: [id(0x0000000a), helpstring("Extracts a pixel array from an image."), helpcontext(0x000075eb)] VARIANT ImageToArray( [optional] VARIANT Left, [optional] VARIANT Top, [optional] VARIANT Width, [optional] VARIANT Height); And in the "gen_py" file has the function as this: def ImageToArray(self, Left=defaultNamedOptArg, Top=defaultNamedOptArg, Width=defaultNamedOptArg, Height=defaultNamedOptArg): """Extracts a pixel array from an image.""" return self._ApplyTypes_(0xa, 1, (12, 0), ((12, 16), (12, 16), (12, 16), (12, 16)), 'ImageToArray', None,Left, Top, Width, Height) I don't know what the (12, 0), (12,16) means, please tell me if the win32com made the right conversion. I don't know where the class hiding the image data. the only function related to the image class is: ArrayToImage() ImageToArray() SetSize() Width Height Can I use some python function directly get the image data from a instance of the class. Thanks Wenhua From jos@trapeze.com Thu Jan 16 21:27:34 2003 From: jos@trapeze.com (Jos Yule) Date: Thu, 16 Jan 2003 16:27:34 -0500 Subject: [python-win32] Is there an interface to "ReadDirectoryChangesW" Message-ID: <3E2723C6.20400@trapeze.com> Last year i was playing around with "FindFirstChangeNotification" for a version control tool i was thinking about, but couldn't get it to work correctly. I've just found out about "ReadDirectoryChangesW", and i think this is the missing bit - can it be called via the win32 python wrapper? Thanks! jos -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: jos@trapeze.com w: http://www.trapeze.com From mhammond@skippinet.com.au Fri Jan 17 02:06:41 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 17 Jan 2003 13:06:41 +1100 Subject: [python-win32] COM problem with array type conversion In-Reply-To: Message-ID: <00a501c2bdcd$148c0060$530f8490@eden> > Looks to me the problem is: win32com have trouble convert a 2d binary > array variant to the right python type. It is possible this is true. The makepy generated code looks fine, and is correctly reflecting that everyting is prototyped as VARIANT. I can point you at the C++ code which does this conversion, but I am not sure how far I can get without the COM object. Mark. From mhammond@skippinet.com.au Fri Jan 17 02:07:56 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 17 Jan 2003 13:07:56 +1100 Subject: [python-win32] Is there an interface to "ReadDirectoryChangesW" In-Reply-To: <3E2723C6.20400@trapeze.com> Message-ID: <00a601c2bdcd$4106df70$530f8490@eden> > Last year i was playing around with > "FindFirstChangeNotification" for a > version control tool i was thinking about, but couldn't get > it to work > correctly. I've just found out about "ReadDirectoryChangesW", and i > think this is the missing bit - can it be called via the win32 python > wrapper? Nope :( Mark. From tim.golden@viacom-outdoor.co.uk Fri Jan 17 07:53:54 2003 From: tim.golden@viacom-outdoor.co.uk (Tim Golden) Date: Fri, 17 Jan 2003 07:53:54 -0000 Subject: [python-win32] Is there an interface to "ReadDirectoryChanges W" Message-ID: Jos Yule> Last year i was playing around with "FindFirstChangeNotification" for a Jos Yule> version control tool i was thinking about, but couldn't get it to work Jos Yule> correctly... Is this any help? I know it doesn't directly answer your question, but maybe it does the same sort of thing. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178 TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From jos@trapeze.com Fri Jan 17 15:05:13 2003 From: jos@trapeze.com (Jos Yule) Date: Fri, 17 Jan 2003 10:05:13 -0500 Subject: [python-win32] Is there an interface to "ReadDirectoryChangesW" In-Reply-To: References: Message-ID: <3E281BA9.2080708@trapeze.com> Huh - that's pretty cool, thanks for the link! I'm going to try this out, my worry is that i have _a lot_ of files to keep track of, and i'm not sure how much this would slow it all down... anyway, i will see how it works out! Thanks again, jos Tim Golden wrote: > Is this any help? I know it doesn't directly answer your question, but maybe > it does the same sort of thing. > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178 > > TJG > -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: jos@trapeze.com w: http://www.trapeze.com From tim.golden@viacom-outdoor.co.uk Fri Jan 17 15:40:13 2003 From: tim.golden@viacom-outdoor.co.uk (Tim Golden) Date: Fri, 17 Jan 2003 15:40:13 -0000 Subject: [python-win32] Is there an interface to "ReadDirectoryChanges W" Message-ID: Yes, no matter how much optimization you piled into the python bits (using dictionaries or bisect lookups or what-have-you) the limiting factor is the os.listdir: depending on your OS setup that can take quite some time to come back. Good luck, and let me know how you get on. I apologise (on their behalf) for the fact that the ActiveState web form for comments completely mangled my helpful comments; the only thing I can now remember of any use was the fact that the FindNextChangeNotification call need only be called when a change is notified, _not_ at every timeout, ie the current notification is active until it finds something. Another possibility which I haven't investigated (because, frankly, I don't need to at the moment) is to use the recently available ctypes module from Thomas Heller (http://starship.python.net/crew/theller/ctypes.html). As I say, I've not tried it, but the noise on c.l.py seems favourable. The idea would be that with this in your toolbelt you could make up for the lack of any particular function in the win32all libraries. TJG -----Original Message----- From: Jos Yule [mailto:jos@trapeze.com] Sent: 17 January 2003 15:05 To: Tim Golden Cc: python-win32@python.org Subject: Re: [python-win32] Is there an interface to "ReadDirectoryChangesW" Huh - that's pretty cool, thanks for the link! I'm going to try this out, my worry is that i have _a lot_ of files to keep track of, and i'm not sure how much this would slow it all down... anyway, i will see how it works out! Thanks again, jos Tim Golden wrote: > Is this any help? I know it doesn't directly answer your question, but maybe > it does the same sort of thing. > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178 > > TJG > -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: jos@trapeze.com w: http://www.trapeze.com ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From wzhang@ic.sunysb.edu Fri Jan 17 18:55:58 2003 From: wzhang@ic.sunysb.edu (WZhang) Date: Fri, 17 Jan 2003 13:55:58 -0500 (EST) Subject: [python-win32] COM problem with array type conversion In-Reply-To: <00a501c2bdcd$148c0060$530f8490@eden> References: <00a501c2bdcd$148c0060$530f8490@eden> Message-ID: I am working on a National Instrument Imaq card that grab images from a camera. The activeX control came with the diver. I am not sure if you can install it without the hardware. Yes please point me the C++ code. Thanks. Wenhua On Fri, 17 Jan 2003, Mark Hammond wrote: > > Looks to me the problem is: win32com have trouble convert a 2d binary > > array variant to the right python type. > > It is possible this is true. The makepy generated code looks fine, and is > correctly reflecting that everyting is prototyped as VARIANT. > > I can point you at the C++ code which does this conversion, but I am not > sure how far I can get without the COM object. > > Mark. > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mhammond@skippinet.com.au Sat Jan 18 00:12:04 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Sat, 18 Jan 2003 11:12:04 +1100 Subject: [python-win32] COM problem with array type conversion In-Reply-To: Message-ID: <000301c2be86$3cd2fab0$530f8490@eden> > I am working on a National Instrument Imaq card that grab > images from a > camera. The activeX control came with the diver. I am not > sure if you can > install it without the hardware. > > Yes please point me the C++ code. Thanks. See http://starship.python.net/crew/mhammond/cvs.html, and in particular http://www.pythonpros.com/cgi-bin/cvsweb.cgi/PyWin32/com/win32com/src/olearg s.cpp Look for the comment: /////////////////////////////////////////////////////////// // // SAFEARRAY support - to/from SAFEARRAYS and Python sequences. // // You will notice VT_UI1 arrays get special handling, so your bug may be in that code. Mark. From th.bangemann@t-online.de Sun Jan 19 01:31:18 2003 From: th.bangemann@t-online.de (Thomas Bangemann) Date: Sun, 19 Jan 2003 02:31:18 +0100 Subject: [python-win32] COM problem with SAFEARRAY type conversion Message-ID: <3E29FFE6.6040309@t-online.de> I need some help for COM problems with SAFEARRAY type conversion. _The background:_ An application(C++) running on OODBMS communicating with DCOM/COM should be queried. A complicated unsatisfying query application based on a selfdefined XML-Query-Language hat to be replaced by a an application high-level programming language (VB, Python, PHP). From my point of view Python could be the first choice. Using the existing COM interface would be the best way to get a smooth integration keeping the old query app as long as necessary. _Python 2.22 (win32-all 152):_ Generating (makePy) and accessing the COM object "AMLAusspielen.AMLSteuerung" seems to work. But it seems that there is the wrong data type conversion. The COM object is registered as “AMLAusspielen.AMLSteuerung”. The method I use is registered as: def AusspielenAQL(self, p_PatternLine=defaultNamedNotOptArg, p_pValue=defaultNamedNotOptArg, p_plResult=defaultNamedNotOptArg): """Methode AusspielenAQL""" return self._ApplyTypes_(0x3, 1, (24, 0), ((16396, 1), (16396, 2), (16387, 2)), 'AusspielenAQL', None,p_PatternLine, p_pValue, p_plResult) - What does the magic numbers of the constants mean? - How can I verify which types are used? - If they are wrong, how can I modify it? - Is something wrong with the interface declaration of the COM object? _C++ client reference application:_ An existing small C++ client application is the reference for using the COM Interface (see the code -> #C++_client). It sends string pattern line by line and shows the following correct results. Put an object on the stack with string pattern: io::PZGruppeOhneLED[type:: ProductCompilation][content::MatrixInit] gives back: 00000000 Accessing the object on the stack with string pattern: content(Name) gives back the property, eg. Name: PZGruppeOhneLED _Python 2.22 (win32-all 152):_ If I try the same with Python (dynamic or static binding doesn’t matter): class easyAql: def __init__(self): win32com.client.gencache.EnsureModule ('{987FCC41-EF6B-11D3-B21E-0050DA5E31BB}',0,1,0) aql = win32com.client.Dispatch('AMLAusspielen.AMLSteuerung') aql = easyAql() Input1 = (): Input2 = (): Output = (): Result = 0 # declaring Output as string or unicode doesn’t matter Input1 = (("io::PZGruppeOhneLED[type::ProductCompilation][content::MatrixInit]",),) Input2 = (("content(Name)",),) pz1 = aql.AusspielenAQL(myPatternLine1, myOutput, myResult) pz2 = aql.AusspielenAQL(myPatternLine2, myOutput, myResult) Returns: ((u'',), 1) ((u'',), 1) # Delivering the string pattern as a tuple of characters with dim and SAFEARRYBOUND returns the same result. # Declaring input as string doesn’t work, the code in oleargs.cpp seem to refuse it too, # oleargs.cpp line 491: OleSetTypeError("Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object.") _C++ client reference application code:_ COleVariant Input; COleVariant Output; // Wrap input for COM transactios SAFEARRAYBOUND Border = { aInputLine.GetSize(), 0}; SAFEARRAY* paStringArray = SafeArrayCreate (VT_BSTR, 1, &Border); for (LONG i = 0;i < aInputLine.GetSize(); i++) { SafeArrayPutElement( paStringArray, &i, (BSTR)(CComBSTR)aInputLine[i]); } Input.vt = (VT_ARRAY | VT_BSTR); Input.parray = paStringArray; LONG lResult; AmlAusspielen->AusspielenAQL( &Input, &Output, &lResult); // For output LONG lCount = 0; SafeArrayGetUBound(Output.parray, 1, &lCount); lCount++; for ( i=0; i < lCount; i++) { CComBSTR oidBSTR; SafeArrayGetElement(Output.parray, &i, &oidBSTR); CString Line = oidBSTR; m_Ausgabe.InsertItem( i, Line); } Serverside COM application converts input variant in CstringArray and back in variant for output. I would be glad to get some help Kind regards Thomas Bangemann From mhammond@skippinet.com.au Sun Jan 19 23:37:09 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Mon, 20 Jan 2003 10:37:09 +1100 Subject: [python-win32] COM problem with SAFEARRAY type conversion In-Reply-To: <3E29FFE6.6040309@t-online.de> Message-ID: <014001c2c013$afc01d30$530f8490@eden> > return self._ApplyTypes_(0x3, 1, (24, 0), ((16396, 1), (16396, 2), > (16387, 2)), 'AusspielenAQL', None,p_PatternLine, p_pValue, > p_plResult) The numbers are: (24, 0), ((16396, 1), (16396, 2), (16387, 2)) Return type (24,0), and a tuple of the args (3 in this case). Each tuple is "param_type, param_flags" 24 = VT_VOID 16396 = VT_BYREF | VT_VARIANT - ie, a byref variant. 1 = PARAMFLAG_FIN, 2 = PARAMFLAG_FOUT > - What does the magic numbers of the constants mean? > - How can I verify which types are used? > - If they are wrong, how can I modify it? If it is wrong, then we have a bug reading the type information. If the type info is actually what is wrong, then that must be fixed. > - Is something wrong with the interface declaration of the COM object? I don't know, but arrays are hard, and we may not be covering all bases. > _C++ client reference application:_ > An existing small C++ client application is the reference for > using the > COM Interface (see the code -> #C++_client). It sends string pattern > line by line and shows the following correct results. > Put an object on the stack with string pattern: > io::PZGruppeOhneLED[type:: ProductCompilation][content::MatrixInit] > gives back: 00000000 > Accessing the object on the stack with string pattern: > content(Name) > gives back the property, eg. Name: PZGruppeOhneLED > > > _Python 2.22 (win32-all 152):_ > If I try the same with Python (dynamic or static binding > doesn’t matter): > > class easyAql: > def __init__(self): > win32com.client.gencache.EnsureModule > ('{987FCC41-EF6B-11D3-B21E-0050DA5E31BB}',0,1,0) > aql = win32com.client.Dispatch('AMLAusspielen.AMLSteuerung') > > aql = easyAql() > Input1 = (): Input2 = (): Output = (): Result = 0 > # declaring Output as string or unicode doesn’t matter > Input1 = > (("io::PZGruppeOhneLED[type::ProductCompilation][content::Matr > ixInit]",),) > Input2 = (("content(Name)",),) > pz1 = aql.AusspielenAQL(myPatternLine1, myOutput, myResult) > pz2 = aql.AusspielenAQL(myPatternLine2, myOutput, myResult) Note that you do not need to present the last 2 params in this case. This is really a bug in win32com that we accept "out" params at all. However, it doesn't hurt. > Returns: > ((u'',), 1) > ((u'',), 1) These are the 2 "out" params we saw above. > # Delivering the string pattern as a tuple of characters with dim and > SAFEARRYBOUND returns the same result. > # Declaring input as string doesn’t work, the code in > oleargs.cpp seem > to refuse it too, > # oleargs.cpp line 491: OleSetTypeError("Objects for > SAFEARRAYS must be > sequences (of sequences), or a buffer object.") This probably will have no effect. The framework should be correctly setting up an empty variant to pass to the function. Regardless, we dont accept strings as safearrays, as a safe array of characters is unlikely to be what you mean. Eg: SomeArrayFunc("foo") Will *not* work directly from Python, as it is unlikely you really wanted Python to auto-translate this to: SomeArrayFunc( ("f", "o", "o"), ) > _C++ client reference application code:_ > > COleVariant Input; > COleVariant Output; > > // Wrap input for COM transactios > SAFEARRAYBOUND Border = { aInputLine.GetSize(), 0}; > SAFEARRAY* paStringArray = SafeArrayCreate (VT_BSTR, 1, &Border); Python will be creating a safe array of VT_VARIANT here, as it has no better indication of the types (other than examining them at runtime, and I don't think it desirable that Python's behaviour changes based purely on the input params passed at runtime) > for (LONG i = 0;i < aInputLine.GetSize(); i++) > { > SafeArrayPutElement( paStringArray, &i, > (BSTR)(CComBSTR)aInputLine[i]); Meaning each element of the array becomes its own VARIANT. > Serverside COM application converts input variant in CstringArray and > back in variant for output. It seems to me that your code is more along the lines of SAFEARRAY(BSTR) than a simple variant. Can you change your C++ code to try more generic arrays? How does VB handle things? Mark. From jos@trapeze.com Mon Jan 20 20:31:35 2003 From: jos@trapeze.com (Jos Yule) Date: Mon, 20 Jan 2003 15:31:35 -0500 Subject: [python-win32] Request: Adding ReadDirectoryChangesW to win32 Message-ID: <3E2C5CA7.4080901@trapeze.com> Hello all. I'm very interested in the functionality that ReadDirectoryChangesW has and am dismayed that it is missing from the win32 package. I've taken a quick look at the win32file.i file on CVS to see what i could do myself to try and add this function to the win32 package. Unfortunately, its not much, as this kind of stuff is way out of my C++ skills. In addition to just not knowing enough c++ and so on, this function can work synchronously or asynchronously, which, as Mark himself said "confuses things a little". But i think Mark H. would be willing to help out if i could get some direction or help from some of you out there that have worked on extending the win32 packages. I've looked at the windows dev site for info about ReadDirectoryChangesW (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/readdirectorychangesw.asp) and aside from the function itself, the other structure that would be needed is (i'm pretty sure the OVERLAPPED one is already done) FILE_NOTIFY_INFORMATION: (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/file_notify_information_str.asp) I hate being in a position where i can not really help out with the actual 'doing' of what i'm asking for, but i will do whatever i can if there is any interest in this functionality. Please let me/the list know if anybody is interested, or just thinks i'm a mooching bonehead. Thanks again, jos ps. the real reason for wanting this function is do create some Version Control tools using Python. Yes, yes, i know that there are many tools out there, but none fit our needs, thus the push to build something in Python. -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: jos@trapeze.com w: http://www.trapeze.com From Jim Abrams Mon Jan 20 17:28:14 2003 From: Jim Abrams (Jim Abrams) Date: Mon, 20 Jan 2003 12:28:14 -0500 Subject: [python-win32] ASP / Response.End flakiness. Message-ID: <1599607915.20030120122814@publishingresources.com> Anyone else seeing this? PythonWin 2.1.1 / win32all 1.5.1 / Win 2k Server *** Script 1 *** <%@LANGUAGE="Python"%> Before End <% Response.End() %> After End *** Output *** Before End After End *** Script 2 *** <%@LANGUAGE="Python"%> Before End <% Response.end() %> After End *** Output *** Before End *** Script 3 *** <%@LANGUAGE="Python"%> <% Response.end() %> After End *** Output *** HTTP/1.1 500 Server Error --- Jim Abrams Sr. Software Engineer Publishing Resources, Inc. 732.548.4609x22 jabrams@publishingresources.com [ Public Key Available: mailto:jabrams@publishingresources.com?subject=PUBKEY ] From mhammond@skippinet.com.au Tue Jan 21 10:44:51 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Tue, 21 Jan 2003 21:44:51 +1100 Subject: [python-win32] Request: Adding ReadDirectoryChangesW to win32 In-Reply-To: <3E2C5CA7.4080901@trapeze.com> Message-ID: <011c01c2c13a$276e28f0$530f8490@eden> > to just not knowing enough c++ and so on, this function can work > synchronously or asynchronously, which, as Mark himself said > "confuses > things a little". One simple option would be to implement this without overlapped support. We allow for an overlapped arg, but raise an exception if not None. This allows you to get started, and paves the way for someone else to "fix" this later. OK - I gave in, and did this. No overlapped support, and I haven't even tested it yet! But it is checked in. Mark. From jens.jorgensen@tallan.com Tue Jan 21 16:35:23 2003 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Tue, 21 Jan 2003 10:35:23 -0600 Subject: [python-win32] ASP / Response.End flakiness. In-Reply-To: <1599607915.20030120122814@publishingresources.com> References: <1599607915.20030120122814@publishingresources.com> Message-ID: <3E2D76CB.109@tallan.com> Yes, I too have found it to be the case in the past (haven't checked recently) that Response.End() does not in fact end the response in python under asp. Jim Abrams wrote: >Anyone else seeing this? > >PythonWin 2.1.1 / win32all 1.5.1 / Win 2k Server > >*** Script 1 *** ><%@LANGUAGE="Python"%> > >Before End > ><% >Response.End() >%> > >After End > >*** Output *** >Before End After End > > > >*** Script 2 *** ><%@LANGUAGE="Python"%> > >Before End > ><% >Response.end() >%> > >After End > >*** Output *** > >Before End > > > >*** Script 3 *** ><%@LANGUAGE="Python"%> ><% >Response.end() >%> > >After End > >*** Output *** >HTTP/1.1 500 Server Error > > > > >--- >Jim Abrams >Sr. Software Engineer >Publishing Resources, Inc. >732.548.4609x22 >jabrams@publishingresources.com > >[ Public Key Available: mailto:jabrams@publishingresources.com?subject=PUBKEY ] > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From jos@trapeze.com Tue Jan 21 19:21:01 2003 From: jos@trapeze.com (Jos Yule) Date: Tue, 21 Jan 2003 14:21:01 -0500 Subject: [python-win32] ReadDirectoryChangesW working Message-ID: <3E2D9D9D.6010401@trapeze.com> First of all, thank you, thank you, thank you. Very very cool. Now i just have to figure out how it works. It seems to block till there is a change, then it 'returns' the change info. Going to have to play with it a bit to get it all figured out. Again, thanks for this! jos ps. Needed to add the following to the win32con.py file: FILE_LIST_DIRECTORY = 0x0001 import os import sys import time import win32file import win32con try: path_to_watch = sys.argv[1] or "." except: path_to_watch = "." path_to_watch = os.path.abspath (path_to_watch) print "Watching %s at %s" % (path_to_watch, time.asctime ()) hDir = win32file.CreateFile( path_to_watch, win32con.FILE_LIST_DIRECTORY, win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, win32con.FILE_FLAG_BACKUP_SEMANTICS, None ) print win32file.ReadDirectoryChangesW( hDir, 1024, 0, win32con.FILE_NOTIFY_CHANGE_LAST_WRITE, None, None ) -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: mailto:jos@trapeze.com w: http://www.trapeze.com From jos@trapeze.com Tue Jan 21 20:36:51 2003 From: jos@trapeze.com (Jos Yule) Date: Tue, 21 Jan 2003 15:36:51 -0500 Subject: [python-win32] ReadDirectoryChangesW Bug... In-Reply-To: <3E2D9D9D.6010401@trapeze.com> References: <3E2D9D9D.6010401@trapeze.com> Message-ID: <3E2DAF63.4070309@trapeze.com> Ok, so it returns an array of tuples. [(action,filename)]. Great. However, the filename has a bunch of 'extra' unicode bytes tacked on to the end of it. I've tried many different values in the buffer_size param to see if i could reduce the amount of garbage bytes, but it seems to have/make no difference. Looking at win32file.i line 1190 where the PyObject_FromFILE_NOTIFY_INFORMATION is defined (just above PyReadDirectoryChangesW) offered me no hints, but i think that there must be some misunderstanding between &bytes_returned/nbytes, which is why there are garbage bytes being malloc'ed onto the end of the fName.FileName object. Or it could just be me not understanding how to use Unicode strings in python... Thanks again, jos ps. the only other weird thing i've found is when using win32con.FILE_NOTIFY_CHANGE_LAST_WRITE, when i save from some program's it will notify me twice, with others only once. I'm sure it has to do with the different write/change/created date attributes... but its not an issue of this function working incorrectly, just me not understanding what the different apps are doing. pps. Here is a trace of what it looks like (the file name is 'test.txt'): D:\Projects\python\testing>script2.py Watching D:\Projects\python\testing at Tue Jan 2 [(3, u'test.txt\u5c30t\u6290t\u7560v\u79b0v')] [(3, u'test.txt\u5c30t\u6290t\u7560v\u79b0v')] from the code: import os import sys import time import win32file import win32con try: path_to_watch = sys.argv[1] or "." except: path_to_watch = "." path_to_watch = os.path.abspath (path_to_watch) print "Watching %s at %s" % (path_to_watch, time.asctime ()) hDir = win32file.CreateFile( path_to_watch, win32con.FILE_LIST_DIRECTORY, win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, win32con.FILE_FLAG_BACKUP_SEMANTICS, None ) while 1: time.sleep(0.1) result = win32file.ReadDirectoryChangesW( hDir, 256, 0, win32con.FILE_NOTIFY_CHANGE_LAST_WRITE, None, None ) print result -- Jos Yule EWACT (employee without a cool title) Trapeze 2 Berkeley St. Suite 305 Toronto, On, CANADA M5A 4J5 t: 416 601 1999 x227 f: 416 601 1997 e: mailto:jos@trapeze.com w: http://www.trapeze.com From mkatz@tapstone.com Tue Jan 21 21:31:24 2003 From: mkatz@tapstone.com (Martin Katz) Date: Tue, 21 Jan 2003 13:31:24 -0800 Subject: [python-win32] _winreg.EnumValue, etc. Message-ID: <3E2DBC2C.20008@tapstone.com> We are trying to read all of the data under specific registry keys. Unfortunately, we cannot seem to enumerate keys or values correctly if the name contains Unicode or binary characters. _winreg.EnumValue, _winreg.EnumKey, win32api.RegEnumValue, and win32api.RegEnumKey all seem to return an ascii-ized version of data instead of just returning a string that contains the correct bytes. Has anybody written a version of these in Python that can deal with arbitrary names? By the way, it looks like the characters in a registry value name can have any 16 bit value except the char(0). The registry key names also cannot contain a backslash. Martin Katz From mhammond@skippinet.com.au Tue Jan 21 23:00:26 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Wed, 22 Jan 2003 10:00:26 +1100 Subject: [python-win32] _winreg.EnumValue, etc. In-Reply-To: <3E2DBC2C.20008@tapstone.com> Message-ID: <025c01c2c1a0$e3c40e00$530f8490@eden> > We are trying to read all of the data under specific registry keys. > Unfortunately, we cannot seem to enumerate keys or values > correctly if > the name contains Unicode or binary characters. Eeek - you mean the *value* names can contain embedded NULL characters?! I don't think you will find a version that works correctly here. You will need to either: * track down calldll or ctypes, and make a "native" call to this API function, fiddling the bits yourself. * be able to build either Python or win32all, and test a fix I will make :) * hack your own extension together with just this function. > _winreg.EnumValue, _winreg.EnumKey, win32api.RegEnumValue, and > win32api.RegEnumKey all seem to return an ascii-ized version of data > instead of just returning a string that contains the correct bytes. Well, the *data* is handled correctly, but not the value name. > By the way, it looks like the characters in a registry value name can > have any 16 bit value except the char(0). The registry key names also > cannot contain a backslash. I assume you mean that the Ascii versions of these functions use an 8 bit MBCS encoding of 16 bit unicode characters? Mark. From mkatz@tapstone.com Wed Jan 22 01:17:38 2003 From: mkatz@tapstone.com (Martin Katz) Date: Tue, 21 Jan 2003 17:17:38 -0800 Subject: [python-win32] _winreg.EnumValue, etc. References: <025c01c2c1a0$e3c40e00$530f8490@eden> Message-ID: <3E2DF132.9040403@tapstone.com> > > >>We are trying to read all of the data under specific registry keys. >>Unfortunately, we cannot seem to enumerate keys or values >>correctly if >>the name contains Unicode or binary characters. >> >> > >Eeek - you mean the *value* names can contain embedded NULL characters?! > > The value names can contain NULL bytes. The NT/2K/XP registry is all MBCS. The value names cannot contain MBCS character 0. The key names >* be able to build either Python or win32all, and test a fix I will make :) > > Testing your fix would be great. I tried just setting the _UNICODE environment variable, but that did not work. >>_winreg.EnumValue, _winreg.EnumKey, win32api.RegEnumValue, and >>win32api.RegEnumKey all seem to return an ascii-ized version of data >>instead of just returning a string that contains the correct bytes. >> > >Well, the *data* is handled correctly, but not the value name. > > > >>By the way, it looks like the characters in a registry value name can >>have any 16 bit value except the char(0). The registry key names also >>cannot contain a backslash. >> >> > >I assume you mean that the Ascii versions of these functions use an 8 bit >MBCS encoding of 16 bit unicode characters? > The value name returned by _winreg.EnumValue appears to be somehow translated to something that looks similar. So, I get 't' when the character was u'u\03e7' . Martin From Andrew Brown Wed Jan 22 08:19:24 2003 From: Andrew Brown (Andrew Brown) Date: Wed, 22 Jan 2003 08:19:24 +0000 Subject: [python-win32] MS unicode bewilderment Message-ID: <150330856696.20030122081924@dial.pipex.com> Forgive me if this question is stupid as well as ignorant, but I have googled and read all I can without finding the answer. I am trying to write some scripts that take MS Word files and write their contents into ascii templates for movable type (a blogging system). I can control Word well enough from Python, with the help of the O'Reilly book about win32 programming (Thank you, Mark). I can get the text out of it, manually convert italic styles to HTML, and do all the other stuff that looked really hard. But I don't know how to search for MS smart quote characters. If I write something like class Wordslice: def __init__(self): import win32com import win32com.client import pubdays try: self.o=win32com.client.Dispatch("Word.Application") self.mydoc=self.o.ActiveDocument self.myrange=self.mydoc.Content except: print "Need word running with a document open, you fool!" ws=Wordslice() ws.myrange.Text # will return a string containing everything in the # word document. My problem is that I don't know what character codes to use to search for MS smartquotes within that string. I have tried \x94, which doesn't work. I have tried various Unicode tricks, and they don't seem to work either. (The point, in case you're wondering, is to find all smart-quoted strings longer than about 100 words and wrap them in
tags. But there is another spinoff: when I write books, I often need to check for quoted passages on which copyright fees pare payable. There is a rule of thumb about the length of "fair comment", something like 400 words. A script that could count quotes and show me the ones over that limit would be really helpful sometimes. -- Andrew Brown http://www.darwinwars.com From janez.jere@void.si Wed Jan 22 13:58:57 2003 From: janez.jere@void.si (Janez Jere) Date: Wed, 22 Jan 2003 14:58:57 +0100 Subject: [python-win32] set breakpoint from code ala DebugBreak Message-ID: Is there a way to set a breakpoint from code, like DebugBreak in win32. I tried for pythonwin, it somehow works, but file must be loaded in pythonwin before calling setBreakPoint() What i have to do to load file in pythonwin before "b.set_break(...)" And probably some message loop is missing to?? Janez import inspect def setBreakPoint(): 'server page will call this function to set break point on next line' modules = sys.modules frameObj, filename, lineNumber, funcName, listSrc, indCurLine = inspect.stack()[1] print frameObj, filename, lineNumber, funcName, listSrc, indCurLine if modules.has_key('pywin.debugger'): import pywin d = pywin.debugger.GetDebugger() d.set_break(filename, lineNumber+1) print 'breakpoint set', filename, lineNumber+1 #import win32api #win32api.DebugBreak() if modules.has_key('HeDbg'): pass print 1 setBreakPoint() print 2 print 'x' From dond@advancedmp.com Wed Jan 22 16:51:24 2003 From: dond@advancedmp.com (Don Dwiggins) Date: 22 Jan 2003 08:51:24 -0800 Subject: [python-win32] Re: MS unicode bewilderment References: <150330856696.20030122081924@dial.pipex.com> Message-ID: Andrew Brown writes: > My problem is that I don't know what character codes to use to search > for MS smartquotes within that string. I have tried \x94, which > doesn't work. I have tried various Unicode tricks, and they don't seem > to work either. (The point, in case you're wondering, is to find all > smart-quoted strings longer than about 100 words and wrap them in >
tags. But there is another spinoff: when I write books, I > often need to check for quoted passages on which copyright fees pare > payable. There is a rule of thumb about the length of "fair comment", > something like 400 words. A script that could count quotes and show me > the ones over that limit would be really helpful sometimes. This doesn't address the Python/Unicode question, but here's a possible workaround: make a copy of the document; in the copy, use MSWord's find/replace to replace smart quotes by "dumb" ones (caveat: I haven't tried this -- it may not work). Save the copy and run your code on it, looking for normal ascii quotes. (You might be able to replace the begin and end smart quotes by different characters, if that's important.) For what it's worth, -- Don Dwiggins "Solvitur Ambulando" d.l.dwiggins@computer.org From dond@advancedmp.com Wed Jan 22 21:28:50 2003 From: dond@advancedmp.com (Don Dwiggins) Date: 22 Jan 2003 13:28:50 -0800 Subject: [python-win32] RE: Blank ASP page using Python 2.2 Message-ID: A note to Mark, and anyone else encountering the "blank ASP page" problem: I just upgraded to Activestate 2.2.2, build 224; in the process, I lost the copy of framework.py I was using, and the problem showed up again. I tried replacing the installed framework.py with the one from win32all-150 (which you'd recommended) -- this didn't work either. I finally found a copy, on a different machine, of the one from -133; this one works. I thought this was worth mentioning in case you dig into the problem again. (BTW, I'd be willing to set up and send you some traces or debug output if it'll help.) FWIW, I'm running Win2K with all the latest upgrades and patches as of a couple of weeks ago, and IIS 5.0.2195.3649. Regards, -- Don Dwiggins "The truth will make you free, d.l.dwiggins@computer.org but first it will make you miserable" -- Tom DeMarco From brian@assess.net Thu Jan 23 00:03:31 2003 From: brian@assess.net (Brian Brown) Date: Wed, 22 Jan 2003 17:03:31 -0700 Subject: [python-win32] ASP import strangeness Message-ID: <1043280211.3e2f31534370d@www.teuton.org> Greetings all, I ran across something I thought was a bit strange... I have a directory called modules which is pointed to by a pth file in the site-packages directory. In modules I have a directory called NutraNet which contains an __init__.py and another python file. It also contains a directory called Templates which also contains and __init__.py and some other python files. >From command line python the following works: from NutraNet.Templates import But from ASP it complains that it can't fine the module 'Templates'. I've looked at sys.modules from both enviroments and the ASP environment doesn't seem to pick up the nested module. Any ideas? thanks! Brian From mhammond@skippinet.com.au Thu Jan 23 11:43:54 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Thu, 23 Jan 2003 22:43:54 +1100 Subject: [python-win32] set breakpoint from code ala DebugBreak In-Reply-To: Message-ID: <021d01c2c2d4$b5db0400$530f8490@eden> Using Pythonwin, you can say: import pywin.debugger pywin.debugger.brk() And have its debugger pop up. Run pywin\debugger\fail.py for an example. Mark. > -----Original Message----- > From: python-win32-admin@python.org > [mailto:python-win32-admin@python.org]On Behalf Of Janez Jere > Sent: Thursday, 23 January 2003 12:59 AM > To: Python-win32@python.org > Subject: [python-win32] set breakpoint from code ala DebugBreak > > > Is there a way to set a breakpoint from code, like DebugBreak > in win32. > I tried for pythonwin, it somehow works, but file must be loaded in > pythonwin before calling setBreakPoint() > > What i have to do to load file in pythonwin before "b.set_break(...)" > And probably some message loop is missing to?? > > Janez > > > import inspect > def setBreakPoint(): > 'server page will call this function to set break point > on next line' > modules = sys.modules > frameObj, filename, lineNumber, funcName, listSrc, indCurLine = > inspect.stack()[1] > print frameObj, filename, lineNumber, funcName, listSrc, > indCurLine > if modules.has_key('pywin.debugger'): > import pywin > d = pywin.debugger.GetDebugger() > d.set_break(filename, lineNumber+1) > print 'breakpoint set', filename, lineNumber+1 > #import win32api > #win32api.DebugBreak() > if modules.has_key('HeDbg'): > pass > > > print 1 > setBreakPoint() > print 2 > print 'x' > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mhammond@skippinet.com.au Thu Jan 23 11:46:50 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Thu, 23 Jan 2003 22:46:50 +1100 Subject: [python-win32] ASP import strangeness In-Reply-To: <1043280211.3e2f31534370d@www.teuton.org> Message-ID: <021f01c2c2d5$1e5e6300$530f8490@eden> > From command line python the following works: > > from NutraNet.Templates import > > But from ASP it complains that it can't fine the module > 'Templates'. I've looked > at sys.modules from both enviroments and the ASP environment > doesn't seem to > pick up the nested module. Not sure what you mean here. For this to work, the parent directory of "NutraNet" must be on sys.path - is this what you see under both environments? Try running: import sys print sys.path import NutraNet print NutraNet.__path__ import NutraNet.Templates print NutraNet.Templates__path__ under both environments. Mark. From s.huijgen@student.tudelft.nl Thu Jan 23 10:44:16 2003 From: s.huijgen@student.tudelft.nl (stephan huijgen) Date: Thu, 23 Jan 2003 11:44:16 +0100 Subject: [python-win32] active excel workbook Message-ID: Hi I have this python program, it works but... the problem is i see nothing on the excel sheet..just a grey screen, like the one before you have opened a file. but when i do the print preview i see the desired sheet... what am i doing wrong? stephan from win32com.client import * ################################################ #file='D:\\MatlabR11\work\b777.xls' #does not work because the file is not yet in right excel format ################################################ file='D:\\b777.xls' xlApp = Dispatch('Excel.Application') xlApp.Visible = 1 xlApp.Workbooks.Open(file) #xlApp.Quit() del xlApp From jens.jorgensen@tallan.com Thu Jan 23 17:51:07 2003 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Thu, 23 Jan 2003 11:51:07 -0600 Subject: [python-win32] active excel workbook In-Reply-To: References: Message-ID: <3E302B8B.8050204@tallan.com> Good question. I tried the same thing on my box and when I open an .xls file it shows up in the screen just like you'd expect. Perhaps you could call Activate() on the Workbook object returned from the Open() call? stephan huijgen wrote: >Hi I have this python program, it works but... >the problem is i see nothing on the excel sheet..just a grey screen, like >the one before you have opened a file. but when i do the print preview i see >the desired sheet... >what am i doing wrong? > >stephan > > >from win32com.client import * >################################################ >#file='D:\\MatlabR11\work\b777.xls' #does not work because the file is not >yet in right excel format >################################################ >file='D:\\b777.xls' >xlApp = Dispatch('Excel.Application') >xlApp.Visible = 1 >xlApp.Workbooks.Open(file) >#xlApp.Quit() >del xlApp > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From brian@assess.net Thu Jan 23 19:12:37 2003 From: brian@assess.net (Brian Brown) Date: Thu, 23 Jan 2003 12:12:37 -0700 Subject: [python-win32] ASP import strangeness In-Reply-To: <021f01c2c2d5$1e5e6300$530f8490@eden> References: <021f01c2c2d5$1e5e6300$530f8490@eden> Message-ID: <1043349157.3e303ea522b98@www.teuton.org> Quoting Mark Hammond : > > From command line python the following works: > > > > from NutraNet.Templates import > > > > But from ASP it complains that it can't fine the module > > 'Templates'. I've looked > > at sys.modules from both enviroments and the ASP environment > > doesn't seem to > > pick up the nested module. > > Not sure what you mean here. For this to work, the parent directory of > "NutraNet" must be on sys.path - is this what you see under both > environments? Which it is... here are the outputs of running what you suggested in both environment: Python: import sys print sys.path ['.', 'C:\\Python22\\Scripts', 'C:\\Python22\\lib\\site- packages\\Pythonwin', 'C:\\Python22\\lib\\site-packages\\win32', 'C:\\Python22 \\lib\\site-packages\\win32\\lib', 'C:\\Python22\\lib\\site- packages', 'C:\\Python22\\DLLs', 'C:\\Python22\\lib', 'C:\\Python22\\lib\\lib- tk', 'C:\\Python22', 'C:\\Python22 \\PIL', 'C:\\InetPub\\wwwroot\\AssessNet\\vr\\modules', 'C:\\Python22 \\lib\\site- packages\\Numeric', 'C:\\InetPub\\wwwroot\\NutraNet\\modules', 'c:\\Python22 \\Lib\\site- packages\\PyUIGui', 'c:\\cygwin\\home\\brian\\RBFoundation', 'c:\\cygwin\\home\ \brian\\RBRapier', 'c:\\cygwin\\home\\brian\\RBPrivate', 'c:\\cygwin\\home\\bri an\\boa', 'C:\\Python22\\lib\\site-packages\\piddle'] import NutraNet print NutraNet.__path__ ['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet'] import NutraNet.Templates print NutraNet.Templates.__path__ ['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet\\Templates'] And here is ASP: sys.path: ----------- ['C:\\Python22\\lib\\site-packages\\Pythonwin', 'C:\\Python22\\lib\\site- packages\\win32', 'C:\\Python22\\lib\\site-packages\\win32\\lib', 'C:\\Python22 \\lib\\site-packages', 'C:\\Python22\\Lib', 'C:\\Python22\\DLLs', 'C:\\Python22 \\Lib\\lib-tk', 'C:\\WINDOWS\\system32', 'C:\\Python22', 'C:\\Python22 \\PIL', 'C:\\InetPub\\wwwroot\\AssessNet\\vr\\modules', 'C:\\Python22 \\lib\\site- packages\\Numeric', 'C:\\InetPub\\wwwroot\\NutraNet\\modules', 'c:\\Python22 \\Lib\\site- packages\\PyUIGui', 'C:\\cygwin\\home\\brian\\RBFoundation', 'C:\\cygwin\\home\ \brian\\RBRapier', 'C:\\cygwin\\home\\brian\\RBPrivate', 'c:\\cygwin\\home\\bri an\\boa', 'C:\\Python22\\lib\\site-packages\\piddle'] ----------- NutraNet.__path__: ----------- ['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet'] ASP throws and exception when trying to import the NutraNet.Templates, so above is only up to printing NutraNet.__path__ > > Try running: > > import sys > print sys.path > import NutraNet > print NutraNet.__path__ > import NutraNet.Templates > print NutraNet.Templates__path__ > > under both environments. > > Mark. > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mhammond@skippinet.com.au Thu Jan 23 22:33:31 2003 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 24 Jan 2003 09:33:31 +1100 Subject: [python-win32] ASP import strangeness In-Reply-To: <1043349157.3e303ea522b98@www.teuton.org> Message-ID: <00c501c2c32f$75c7e8f0$530f8490@eden> > And here is ASP: > sys.path: > ----------- > ['C:\\Python22\\lib\\site-packages\\Pythonwin', > 'C:\\Python22\\lib\\site- > packages\\win32', > 'C:\\Python22\\lib\\site-packages\\win32\\lib', 'C:\\Python22 > \\lib\\site-packages', 'C:\\Python22\\Lib', > 'C:\\Python22\\DLLs', 'C:\\Python22 > \\Lib\\lib-tk', 'C:\\WINDOWS\\system32', 'C:\\Python22', 'C:\\Python22 > \\PIL', 'C:\\InetPub\\wwwroot\\AssessNet\\vr\\modules', 'C:\\Python22 > \\lib\\site- > packages\\Numeric', > 'C:\\InetPub\\wwwroot\\NutraNet\\modules', 'c:\\Python22 > \\Lib\\site- > packages\\PyUIGui', 'C:\\cygwin\\home\\brian\\RBFoundation', > 'C:\\cygwin\\home\ > \brian\\RBRapier', 'C:\\cygwin\\home\\brian\\RBPrivate', > 'c:\\cygwin\\home\\bri > an\\boa', 'C:\\Python22\\lib\\site-packages\\piddle'] > ----------- > NutraNet.__path__: > ----------- > ['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet'] > > > ASP throws and exception when trying to import the > NutraNet.Templates, so > above is only up to printing NutraNet.__path__ Very strange! Is it possible that the Templates directory has wierd permissions, meaning the localsystem user (under which ASP runs) can not see the directory? Mark. From brian@assess.net Thu Jan 23 23:41:17 2003 From: brian@assess.net (Brian Brown) Date: Thu, 23 Jan 2003 16:41:17 -0700 Subject: [python-win32] ASP import strangeness In-Reply-To: <00c501c2c32f$75c7e8f0$530f8490@eden> References: <00c501c2c32f$75c7e8f0$530f8490@eden> Message-ID: <1043365277.3e307d9d87a50@www.teuton.org> Quoting Mark Hammond : > > Very strange! Is it possible that the Templates directory has wierd > permissions, meaning the localsystem user (under which ASP runs) can not see > the directory? > > Mark. Mark, you're a flippin' genius. That was it; I added IUSR_ to the directory and it works fine. I was having similar problems with accessing databases and solved it this way, but it just didn't occur to me for modules... thanks! Brian From aka@mvps.org Fri Jan 24 02:02:25 2003 From: aka@mvps.org (Alex K. Angelopoulos) Date: Thu, 23 Jan 2003 21:02:25 -0500 Subject: [python-win32] active excel workbook References: Message-ID: <001101c2c34c$a5f171f0$0b02a8c0@aka1> What version of Excel is this, and by any chance would the worksheet have been hidden by the original generating process? One way to verify that is when Excel starts up this way, go to the Window menu and see if "UnHide" is an allowed choice there. -- Alex K. Angelopoulos MCSE, MVP [Terminal Services] http://dev.remotenetworktechnology.com ----- Original Message ----- From: "stephan huijgen" To: Sent: Thursday, 2003-01-23 05:44 Subject: [python-win32] active excel workbook > Hi I have this python program, it works but... > the problem is i see nothing on the excel sheet..just a grey screen, like > the one before you have opened a file. but when i do the print preview i see > the desired sheet... > what am i doing wrong? > > stephan > > > from win32com.client import * > ################################################ > #file='D:\\MatlabR11\work\b777.xls' #does not work because the file is not > yet in right excel format > ################################################ > file='D:\\b777.xls' > xlApp = Dispatch('Excel.Application') > xlApp.Visible = 1 > xlApp.Workbooks.Open(file) > #xlApp.Quit() > del xlApp > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From denethor10@mail.com Sun Jan 26 16:31:13 2003 From: denethor10@mail.com (billy bob) Date: Sun, 26 Jan 2003 11:31:13 -0500 Subject: [python-win32] PyRun_File() Message-ID: <20030126163113.91910.qmail@mail.com> I'm using the Python C++ API This function won't work on my complier. The docs state that it is becasue the FILE strucure, used in this function, is incompatible across different libraries. How can I solve this? -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Meet Singles http://corp.mail.com/lavalife From niki@vintech.bg Mon Jan 27 09:07:12 2003 From: niki@vintech.bg (Niki Spahiev) Date: Mon, 27 Jan 2003 11:07:12 +0200 Subject: [python-win32] PyRun_File() In-Reply-To: <20030126163113.91910.qmail@mail.com> References: <20030126163113.91910.qmail@mail.com> Message-ID: <3E34F6C0.4010702@vintech.bg> billy bob wrote: > I'm using the Python C++ API This function won't work on my complier. The docs state that it is becasue the FILE strucure, used in this function, is incompatible across different libraries. How can I solve this? IIRC there is PyFile_Open or something like that for making compatible FILE pointers. (In recent Python versions) HTH Niki Spahiev From jesper.groth.loehr@almbrand.dk Mon Jan 27 09:25:35 2003 From: jesper.groth.loehr@almbrand.dk (jesper.groth.loehr@almbrand.dk) Date: Mon, 27 Jan 2003 10:25:35 +0100 Subject: [python-win32] Why is there not any AddAccessAllowedAceEx in win32security? Message-ID: <41256CBB.003381EC.00@ABRNOT0.ALMBRAND.DK> Hello I am trying to set the ACL on a directory. I would like to make the files in the directory inherit the ACE entries. The documentation on MSDN describes the function AddAccessAllowedAceEx to control whether the ACE can be inherited by child objects. But the PyACL class from win32security only implements AddAccessAllowedAce which does not set the ACE flags. Is there any reason why AddAccessAllowedAceEx is not available in win32security? Is there any other way of setting the flags of the ACEs? Thank you Jesper Loehr