I have an external method like this: import os def ext_programm(): os.system('notepad.exe') But it doesn't work. -- View this message in context: http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.h... Sent from the Zope - General mailing list archive at Nabble.com.
--On 16. August 2007 21:21:36 -0700 rieh25 <robertoedwins@gmail.com> wrote:
I have an external method like this:
import os
def ext_programm(): os.system('notepad.exe')
But it doesn't work.
You can figure it out yourself by checking the return value of os.system() and by checking the console messages. Likely you're search path is not set properly. -aj
What is a search path and how do I set it? -- View this message in context: http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.h... Sent from the Zope - General mailing list archive at Nabble.com.
I think it's finding the programm because I'm using the complete path. And when I test it using the wrong programm name, it returns a 1. But instead, when I pass it the right name, it just hangs. In the task manager there is an entry for the program, but it doesn't seem to execute. Thanks for the help. -- View this message in context: http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.h... Sent from the Zope - General mailing list archive at Nabble.com.
+-------[ rieh25 ]---------------------- | | I think it's finding the programm because I'm using the complete path. And | when I test it using the wrong programm name, it returns a 1. But instead, | when I pass it the right name, it just hangs. In the task manager there is | an entry for the program, but it doesn't seem to execute. Thanks for the | help. Are you trying to start an interactive windows programme, from inside a programme started as a windows service? Because the default mode for this, is not to show windows from apps started as services. -- Andrew Milton akm@theinternet.com.au
--On 16. August 2007 22:40:45 -0700 rieh25 <robertoedwins@gmail.com> wrote:
I think it's finding the programm because I'm using the complete path. And when I test it using the wrong programm name, it returns a 1. But instead, when I pass it the right name, it just hangs. In the task manager there is an entry for the program, but it doesn't seem to execute. Thanks for the help.
You're misusing Zope is an evil way. External methods are not designed to start desktop apps. Don't do that - unless you know what you are doing. The right approach would be to trigger the start of an application through an URL handler or something like that. Basically "ExternalEditor" (your magic search term) would be a good starting point. -aj
On Thu, Aug 16, 2007 at 10:40:45PM -0700, rieh25 wrote:
I think it's finding the programm because I'm using the complete path. And when I test it using the wrong programm name, it returns a 1. But instead, when I pass it the right name, it just hangs. In the task manager there is an entry for the program, but it doesn't seem to execute. Thanks for the help.
How is your Zope running? If it is running as a system service it has nothing to do with the current logged on user that has a desktop open. So Windows will not show notepad on the desktop... The question is: what is the problem you are trying to solve with this? Why should the webserver open a notepad? Try playing with a commandline program that does something usefull but does not need interaction (a batch file or something like that) -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
I'm trying to insert a large amount of records into a database table based on a query. When I try doing it directly from a Zope programm it gives a time out, because the query takes too much time. Therefore I thought of doing it from a python script with an odbc connection, called with os.system() within an external method. When I execute it from cmd it works, but when I try to call it from an external method it hangs. -- View this message in context: http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.h... Sent from the Zope - General mailing list archive at Nabble.com.
You probably want NT Script. We use that on our public PCs in the library. We have CDs in a tower and use NT Script to map a CD and a drive from a server that has an executable to access the CD or run the executable from the client machine. Every machine has NT Script installed. In 1995 when we started using this script I was able to license something like 200 licenses for about $250. The link to PC World to download it says its $20 now and I can't even find it on the creators WEB site any more although the 30 day trial can be downloaded from PC World. For a Windows app its pretty neat, has a nice little debugger built in. For use from a web link we use the extension .prg on all of our nt scripts and associate that extension with ntscript.exe. This is the script for opening notepad is a dtml document named notepad.prg. <dtml-call "RESPONSE.setHeader('Content-Type', 'application/x-ntscript')"> sub main<dtml-var my_return>shell "\windows\notepad.exe" <dtml-var my_return>endsub <dtml-var my_return> is a Script (Python) that contains only: print "\r" return printed This was the only way to get the script to work, using carriage returns in the script did not work. This script {force} maps drives S and T to two directories on server1 then starts a local application my_app.exe and that executable's parameters to use drive s and t for its data. <dtml-call "RESPONSE.setHeader('Content-Type', 'application/x-ntscript')"> sub main<dtml-var my_return>$x$=netuse "S:" "\\server1\arev" {force}<dtml-var my_return>$x$=netuse "T:" "\\server1\arev2" {force}<dtml-var my_return>shell "C:\my_dir\AREVWin\my_app.EXE -c~\ARVW.mnu -t~\bib.trl -aAREV -pS: \AREV_C\AREV1.D01 -qT:\AREV_C\AREV1.D02" {maximize}<dtml-var my_return>endsub This method of running local applications from the WEB can be very dangerous if another WEB site has an NTScript source on the WEB with a .prg extension and the source something like <dtml-call "RESPONSE.setHeader('Content-Type', 'application/x-ntscript')"> sub main<dtml-var my_return>shell "fdisk.exe" <dtml-var my_return>endsub Thomas On Friday 17 August 2007 03:58, Reinoud van Leeuwen wrote:
On Thu, Aug 16, 2007 at 10:40:45PM -0700, rieh25 wrote:
I think it's finding the programm because I'm using the complete path. And when I test it using the wrong programm name, it returns a 1. But instead, when I pass it the right name, it just hangs. In the task manager there is an entry for the program, but it doesn't seem to execute. Thanks for the help.
How is your Zope running? If it is running as a system service it has nothing to do with the current logged on user that has a desktop open. So Windows will not show notepad on the desktop... The question is: what is the problem you are trying to solve with this? Why should the webserver open a notepad? Try playing with a commandline program that does something usefull but does not need interaction (a batch file or something like that)
-- ==================================================================== Thomas McMillan Grant Bennett Appalachian State University Operations & Systems Analyst P O Box 32026 University Library Boone, North Carolina 28608 (828) 262 6587 They say a picture is worth a thousand words. As videos could be 25 pictures per second and might last several minutes, how many words is that? - Linux Journal, July 2007 Library Systems Help Desk: http://www.library.appstate.edu/help/ ====================================================================
It works when I start Zope with runzope, instead of starting it a a server. It's not really a problem to me because I can create a windows shceduled task to start zope everytime the server is turned on. I need to do it from Zope because the user needs to specify some parameters for the query, so I'm going to do it this way instead of using some other tool... Thanks to all Reinoud van Leeuwen wrote:
On Thu, Aug 16, 2007 at 10:40:45PM -0700, rieh25 wrote:
I think it's finding the programm because I'm using the complete path. And when I test it using the wrong programm name, it returns a 1. But instead, when I pass it the right name, it just hangs. In the task manager there is an entry for the program, but it doesn't seem to execute. Thanks for the help.
How is your Zope running? If it is running as a system service it has nothing to do with the current logged on user that has a desktop open. So Windows will not show notepad on the desktop... The question is: what is the problem you are trying to solve with this? Why should the webserver open a notepad? Try playing with a commandline program that does something usefull but does not need interaction (a batch file or something like that)
-- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________ _______________________________________________ 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 )
-- View this message in context: http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.h... Sent from the Zope - General mailing list archive at Nabble.com.
participants (5)
-
Andreas Jung -
Andrew Milton -
Reinoud van Leeuwen -
rieh25 -
Thomas Bennett