Re: [python-win32] Querying the VNC Service fails sometimes

2008-06-24 Thread Mike Driscoll

Kevin,

Also check the permissions on the problem users registry.  I would 
expect that to cause a different error, but it might be worth checking.


Most users are local admins. And it's just been happening for the last 
couple of weeks, so it's likely what Roger said: a corrupt registry 
entry. I tried upgrading to 211 last night and am waiting for that user 
to login again. For some reason, after upgrading to 211, I am getting an 
import error on my wx module. Are these tied together in some weird way?




Kevin Horn

On Mon, Jun 23, 2008 at 2:25 PM, Roger Upole <[EMAIL PROTECTED] 
> wrote:



Mike Driscoll wrote:

Mike Driscoll wrote:

Hi,

In one of my login scripts for work, I run a query to see
if the VNC
service is running using the win32serviceutil module. The
code for
that I am using looks something like this:


import win32serviceutil
serviceState = win32serviceutil.QueryServiceStatus('VNC
Server')[1]


This works in 99.99% of cases. However, I have on user
that keeps
getting the following traceback:

Traceback (most recent call last):
 File "\\ourServer\pathName\PostLogon.py", line 207, in ?
  serviceState = win32serviceutil.QueryServiceStatus('VNC
Server')[1]
 File

"\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
line 479, in QueryServiceStatus
  hs = SmartOpenService(hscm, serviceName,
win32service.SERVICE_QUERY_STATUS)
 File

"\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
line 81, in SmartOpenService
  name = _GetServiceShortName(name)
 File

"\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
line 62, in _GetServiceShortName
  skey = win32api.RegOpenKey(hkey, svc, 0, access)
error: (2, 'RegOpenKeyEx', 'The system cannot find the
file specified.')






I forgot to mention that we use Windows XP, Python 2.4 and PyWin32
version 210.

Mike


You might want to try build 211.  It uses the API function
GetServiceKeyName instead of manually enumerating the
registry.

However, it sounds like you could have a corrupt registry key.
Try reinstalling the service and see if that helps.

   Roger



Mike
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] import cx_Oracle in ASP

2008-06-24 Thread Tibor Arpas
Hi,

I'm trying to connect to database from ASP. I reduced my source to the
following snippet:

<%@ LANGUAGE = Python%>




<%

import sys

for s in sys.path:
Response.Write(s)
Response.Write("")

import cx_Oracle

%>



After invoking the asp page I get the following result:

C:\ActivePython25\lib\site-packages\setuptools-0.6c8-py2.5.egg
C:\ActivePython25\lib\site-packages\cx_oracle-4.3.3-py2.5-win32.egg
C:\ActivePython25\lib\site-packages\owslib-0.3-py2.5.egg
C:\ActivePython25\lib\site-packages\tilecache-2.02-py2.5.egg
C:\ActivePython25\lib\site-packages\paste-1.6-py2.5.egg
C:\ActivePython25\lib\site-packages\pysqlite-2.4.1-py2.5-win32.egg
C:\ActivePython25\lib\site-packages\pil-1.1.6-py2.5-win32.egg
C:\WINDOWS\system32\python25.zip
C:\ActivePython25\Lib
C:\ActivePython25\DLLs
C:\ActivePython25\Lib\lib-tk
c:\windows\system32\inetsrv
C:\ActivePython25
C:\ActivePython25\lib\site-packages
C:\ActivePython25\lib\site-packages\win32
C:\ActivePython25\lib\site-packages\win32\lib
C:\ActivePython25\lib\site-packages\Pythonwin

Python ActiveX Scripting Engine error '80020009'

Traceback (most recent call last): File "

Re: [python-win32] Querying the VNC Service fails sometimes

2008-06-24 Thread Mark Hammond
> For some reason, after upgrading to 211, I am getting
> an
> import error on my wx module. Are these tied together in some weird
> way?

Not that I can think of, and build 211 didn't add any funky new import
tricks or anything.  However, build 211 is packing the MFC DLL now, so
*that* could be related - try removing the MFC that is installed in the
site-packages\pythonwin directory.  What does the import error say?

Cheers,

Mark

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] FireEvent : comtypes work but win32com fails, why?

2008-06-24 Thread June Kim
IE's FireEvent works with a single argument, for example,
FireEvent("onKeyUp"). However, it doesn't work with two arguments :
FireEvent("onKeyUp",event).

But It works without a problem with comtypes.

See the following example to reproduce and compare:


file: c:/temp/javascripttest/onkeyup.html



onkeyup

function showmeevent() {
  document.getElementById("here").innerHTML+="[+] "+event.keyCode +"
"; document.lastKeyCode=event.keyCode; } Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from win32com.client import DispatchEx >>> ie=DispatchEx('InternetExplorer.Application') >>> ie.Visible=True >>> ie.Visible=False >>> ie.Navigate('c:/temp/javascripttest/onkeyup.html') >>> ie.Visible=True >>> e=ie.Document.CreateEventObject() >>> e.keyCode=65 >>> ie.Document.all.inp.FireEvent("onkeyup",e) True >>> ie.Document.lastKeyCode 0 On the html document displayed on the browser I see "0" is appended. The event object that I created with new keyCode didn't get passed. Now with comtypes: >>> from comtypes.client import CreateObject >>> ie2=CreateObject("InternetExplorer.Application") >>> ie2.Visible=True >>> ie2.Navigate('c:/temp/javascripttest/onkeyup.html') 0 >>> e2=ie2.Document.CreateEventObject() >>> e2.keyCode=65 >>> ie2.Document.all.inp.FireEvent("onkeyup",e2) True >>> ie2.Document.lastKeyCode Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 216, in __geta ttr__ raise AttributeError(name) AttributeError: lastKeyCode Accessing lastKeyCode from ie2.Document wasn't possible but the event obejct is passed successfully -- I see 65 appended to the document. In summary, there are one big problem and one minor problem. The first is about pywin32's inability to pass FireEvent's second argument. The second is about comtypes inability to access Document's attributes. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32

Re: [python-win32] FireEvent : comtypes work but win32com fails, why?

2008-06-24 Thread June Kim
2008/6/25 June Kim <[EMAIL PROTECTED]>:
> IE's FireEvent works with a single argument, for example,
> FireEvent("onKeyUp"). However, it doesn't work with two arguments :
> FireEvent("onKeyUp",event).
>
> But It works without a problem with comtypes.
>
> See the following example to reproduce and compare:
>
>
> file: c:/temp/javascripttest/onkeyup.html
>
> 
> 
> onkeyup
> 
> function showmeevent() {
>  document.getElementById("here").innerHTML+="[+] "+event.keyCode +"
"; > document.lastKeyCode=event.keyCode; > } > > > > > > > > > > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. from win32com.client import DispatchEx ie=DispatchEx('InternetExplorer.Application') ie.Visible=True ie.Visible=False ie.Navigate('c:/temp/javascripttest/onkeyup.html') ie.Visible=True e=ie.Document.CreateEventObject() e.keyCode=65 ie.Document.all.inp.FireEvent("onkeyup",e) > True ie.Document.lastKeyCode > 0 > > On the html document displayed on the browser I see "0" is appended. > The event object that I created with new keyCode didn't get passed. > > Now with comtypes: > from comtypes.client import CreateObject ie2=CreateObject("InternetExplorer.Application") ie2.Visible=True ie2.Navigate('c:/temp/javascripttest/onkeyup.html') > 0 e2=ie2.Document.CreateEventObject() e2.keyCode=65 ie2.Document.all.inp.FireEvent("onkeyup",e2) > True ie2.Document.lastKeyCode > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 216, in > __geta > ttr__ >raise AttributeError(name) > AttributeError: lastKeyCode > > Accessing lastKeyCode from ie2.Document wasn't possible but the event > obejct is passed successfully -- I see 65 appended to the document. > > > In summary, there are one big problem and one minor problem. The first > is about pywin32's inability to pass FireEvent's second argument. The > second is about comtypes inability to access Document's attributes. > The minor problem is solvable with: comtypes.client.dynamic.Dispatch(ie2.Document).lastKeyCode even though I am not sure if this is the right way. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32

Re: [python-win32] FireEvent : comtypes work but win32com fails, why?

2008-06-24 Thread Mark Hammond
> > In summary, there are one big problem and one minor problem. The
> > first
> > is about pywin32's inability to pass FireEvent's second argument.

I can't explain that :(  I've stepped through the code, and it seems we are
passing a VT_VARIANT containing a VT_BYREF|VT_DISPATCH.  I'm afraid I'm not
familiar enough with comtypes to know how it is passing that param.

Cheers,

Mark

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32