VideoCapture module fails under Zope on Win32
I've been playing with the python VideoCapture webcam module (http://videocapture.sourceforge.net/), and thought: wouldn't it be nice to wrap this in a Zope product! Yes, yes it would, I agreed with myself. Webcam controllable directly from Zope... Unfortunately I quickly seem to have hit a hurdle I can not get over. The VideoCapture module can not seem to open the device when running under Zope. The code works perfectly fine, using Zope's python version, when run from the command line outside of Zope... but inside Zope the identical (cut/paste) code always fails. The error message returned by the vidcap.pyd when trying to connect to the camera device is generic, so I can't see what specifically the problem is (if the windows error code is any more specific). I have the source, of course, but I'm not a c++ person so have no compiler. Anyhow it seems doubtful I'd be able to get around whatever the problem is. I'm just wondering if anyone might be able to enlighten me on possible reasons for this behaviour. I think vaguely recall that Zope on Windows runs at some sort of lowered privileges (but i could remember incorrectly; I don't know how these sorts of things work on Win32). Could this be the cause? How might one get around this, if so? -- Tim Middleton | Cain Gang Ltd | I have lived through whole tragedies x@veX.net | www.Vex.Net | without speaking a word. --Dost. (GC)
According to the SourceForge page, the VideoCapture binary is compiled against Python 2.2. You probably have that installed on your system somewhere, so it works fine at the command line. Current production versions of Zope run Python 2.1.3. I would guess this is the source of your problem. Perhaps your project is interesting enough the VideoCapture maintainers might release a binary compiled against 2.1.3? Dylan At 11:29 AM 2/27/2003, Tim wrote:
I've been playing with the python VideoCapture webcam module (http://videocapture.sourceforge.net/), and thought: wouldn't it be nice to wrap this in a Zope product! Yes, yes it would, I agreed with myself. Webcam controllable directly from Zope...
Unfortunately I quickly seem to have hit a hurdle I can not get over. The VideoCapture module can not seem to open the device when running under Zope. The code works perfectly fine, using Zope's python version, when run from the command line outside of Zope... but inside Zope the identical (cut/paste) code always fails.
The error message returned by the vidcap.pyd when trying to connect to the camera device is generic, so I can't see what specifically the problem is (if the windows error code is any more specific). I have the source, of course, but I'm not a c++ person so have no compiler. Anyhow it seems doubtful I'd be able to get around whatever the problem is.
I'm just wondering if anyone might be able to enlighten me on possible reasons for this behaviour. I think vaguely recall that Zope on Windows runs at some sort of lowered privileges (but i could remember incorrectly; I don't know how these sorts of things work on Win32). Could this be the cause? How might one get around this, if so?
-- Tim Middleton | Cain Gang Ltd | I have lived through whole tragedies x@veX.net | www.Vex.Net | without speaking a word. --Dost. (GC)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Dylan wrote on Thursday, February 27, 2003, 3:22:21 PM:
According to the SourceForge page, the VideoCapture binary is compiled against Python 2.2. You probably have that installed on your system somewhere, so it works fine at the command line.
This is not the case. The VideoCapture archive actually comes with compiled binaries for 2.0, 2.1 and 2.2 in separate directories. I have both python 2.2 and 2.1 installed on this box, it is true, and that i installed the appropriate VideoCapture modules in both versions. But, it's also true that for testing i used the full path to the appropriate python interpreters and tested both versions (to make sure they worked the same) via the command line... they do. It's just under Zope (python 2.1.3) that there is a problem. Any other ideas? (-: -- Tim Middleton | Cain Gang Ltd | I was allowed to play at philosophy no x@veX.net | www.Vex.Net | longer. --C.S.Lewis (SBJ)
Not actually knowing anything about VideoCapture, but this could be some privilege issue. Do you e.g. have to be Administrator to be able to open the device? Zope will very likely run under an unprivileged account. Try to not run Zope as a service but from a DOS box, logged in as Administrator or yourself (assuming your account has the required privileges). Does this make a difference? HTH, Stefan --On Freitag, 28. Februar 2003 05:48 -0500 Tim <tim@xxvii.net> wrote:
Dylan wrote on Thursday, February 27, 2003, 3:22:21 PM:
According to the SourceForge page, the VideoCapture binary is compiled against Python 2.2. You probably have that installed on your system somewhere, so it works fine at the command line.
This is not the case. The VideoCapture archive actually comes with compiled binaries for 2.0, 2.1 and 2.2 in separate directories. I have both python 2.2 and 2.1 installed on this box, it is true, and that i installed the appropriate VideoCapture modules in both versions. But, it's also true that for testing i used the full path to the appropriate python interpreters and tested both versions (to make sure they worked the same) via the command line... they do. It's just under Zope (python 2.1.3) that there is a problem.
Any other ideas? (-:
-- Tim Middleton | Cain Gang Ltd | I was allowed to play at philosophy no x@veX.net | www.Vex.Net | longer. --C.S.Lewis (SBJ)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Those who write software only for pay should go hurt some other field. /Erik Naggum/
At 02:48 AM 2/28/2003, Tim wrote:
Dylan wrote on Thursday, February 27, 2003, 3:22:21 PM:
According to the SourceForge page, the VideoCapture binary is compiled against Python 2.2. You probably have that installed on your system somewhere, so it works fine at the command line.
This is not the case. The VideoCapture archive actually comes with compiled binaries for 2.0, 2.1 and 2.2 in separate directories.
Darn... there goes my neat & tidy theory. :-) It might be a permissions issue. Is Zope running as a service? If that doesn't straighten things out, could you provide a snip of the code that works at the CLI but doesn't work in your product and any traceback you're getting? Dylan
Dylan wrote on Friday, February 28, 2003, 12:06:00 PM:
It might be a permissions issue. Is Zope running as a service?
Nice to get all these suggestions from you and Stefan. Zope was not running as a service (for development i run it manually so i can see any stdout/stderr more easily), but i just tried it as a service with the same results (it doesn't work). This XP box has just one account with full Administrator privileges (yeah, bad, i know).
If that doesn't straighten things out, could you provide a snip of the code that works at the CLI but doesn't work in your product and any traceback you're getting?
There's not much code to show. But I'll be happy to give a complete report below for anyone willing to spare valuable time to look at it. Trying to isolate the problem, i made things as minimal as possible. The following few lines are a module which runs fine from the CLI, but when in my tiny little minimal product import this module and call the function ... it doesn't work. It's the call to Device() that fails. --- vidtest.py --- from VideoCapture import Device def getdev(): cam = Device(devnum=0) return cam if __name__ == '__main__': print getdev() ---end of vidtest.py---
From the command line:
"h:\Program Files\ozope\bin\python.exe" vidtest.py <VideoCapture.Device instance at 008800BC>
Now here is the zope product test method: def test(self): "public" import vidtest return vidtest.getdev() Results from zope: Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Products.ZVideoCapture.ZVideoCapture, line 32, in test Module Products.ZVideoCapture.vidtest, line 4, in getdev Module VideoCapture, line 49, in __init__ Error: Creation of the filter graph failed. -- Tim Middleton | Cain Gang Ltd | Then suddenly, for no apparent reason, the x@veX.net | www.Vex.Net | unpitying orchestra struck up a polka. -D
At 01:00 AM 3/1/2003, Tim wrote:
Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Products.ZVideoCapture.ZVideoCapture, line 32, in test Module Products.ZVideoCapture.vidtest, line 4, in getdev Module VideoCapture, line 49, in __init__ Error: Creation of the filter graph failed.
Ugh. Line 49 calls a method in a pyd file. Tough to know why the filter graph creation failed without seeing it. It may well be the case that the VideoCapture maintainers would have a pretty good idea of what might cause this error. That could push us in the right direction. It might also be possible to get a better traceback. Put line 49 inside a try...except and kick back your own exception. Check out this recipe for some hints how you might get some richer information on what's gone wrong: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52215 I haven't tried any of that in a Zope object, though it works like a charm in other Python stuff. That's about what I can think of at the moment. Dylan
Dylan wrote on Sunday, March 2, 2003, 8:36:03 PM:
Ugh. Line 49 calls a method in a pyd file. Tough to know why the filter graph creation failed without seeing it.
Been there, done that too. (-: The exception is actually coming from the call in the c++ code to open the device. The call does return a code of some sort; but i have no idea what that code is. The module author simply checks for non-true (or non-false, i can't remember), and if it fails, raises that exception... with no further info.
It may well be the case that the VideoCapture maintainers would have a pretty good idea of what might cause this error. That could push
Already tried this before posting to the Zope list. The author, unfortunately, said he had no idea, and had no time to fiddle with the code anymore. Oh well. Honestly i don't have time to be fiddling with my silly webcam these days either. <-: Would have been nice if it "just worked"... or someone had a quick answer. oh well.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52215
If nothing else, i get this handy snippet out of all this. (-: -- Tim Middleton | Cain Gang Ltd | There are a thousand hacking at the branches x@veX.net | www.Vex.Net | of evil [but who] at the root. --Thoreau (W)
At 01:23 AM 3/3/2003, Tim wrote:
Dylan wrote on Sunday, March 2, 2003, 8:36:03 PM:
It may well be the case that the VideoCapture maintainers would have a pretty good idea of what might cause this error. That could push
Already tried this before posting to the Zope list. The author, unfortunately, said he had no idea, and had no time to fiddle with the code anymore.
Bummer. One other thought... if this works from the command line, what about ditching the product format and moving over to an set of External Methods and ZMI interface methods? It's not as neat and tidy, but it might get the job done.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52215
If nothing else, i get this handy snippet out of all this. (-:
Well, at least there's a silver lining *somewhere* in this cloud. :-) Dylan
participants (3)
-
Dylan Reinhardt -
Stefan H. Holek -
Tim