Re: [Zope] Why doesn't os.system(command) work?

2007-08-17 Thread Andreas Jung



--On 16. August 2007 22:40:45 -0700 rieh25 [EMAIL PROTECTED] 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

pgphMp6Kiixli.pgp
Description: PGP signature
___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-17 Thread Reinoud van Leeuwen
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[EMAIL PROTECTED]
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-17 Thread rieh25

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.html#a12200029
Sent from the Zope - General mailing list archive at Nabble.com.

___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-17 Thread Thomas Bennett
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 maindtml-var my_returnshell \windows\notepad.exe dtml-var 
my_returnendsub

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 maindtml-var my_return$x$=netuse S: \\server1\arev {force}dtml-var 
my_return$x$=netuse T: \\server1\arev2 {force}dtml-var my_returnshell 
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_returnendsub


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 maindtml-var my_returnshell fdisk.exe dtml-var my_returnendsub

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 AnalystP 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/

___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-17 Thread rieh25

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[EMAIL PROTECTED]
 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.html#a12201181
Sent from the Zope - General mailing list archive at Nabble.com.

___
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 )


[Zope] Why doesn't os.system(command) work?

2007-08-16 Thread rieh25

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.html#a12193786
Sent from the Zope - General mailing list archive at Nabble.com.

___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-16 Thread Andreas Jung



--On 16. August 2007 21:21:36 -0700 rieh25 [EMAIL PROTECTED] 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

pgpfeozwQBqH5.pgp
Description: PGP signature
___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-16 Thread rieh25

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.html#a12194033
Sent from the Zope - General mailing list archive at Nabble.com.

___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-16 Thread Andreas Jung



--On 16. August 2007 21:58:08 -0700 rieh25 [EMAIL PROTECTED] wrote:



What is a search path and how do I set it?



Google windows search path.

-aj

pgpptZy8FpD0f.pgp
Description: PGP signature
___
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 )


Re: [Zope] Why doesn't os.system(command) work?

2007-08-16 Thread 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.

-- 
View this message in context: 
http://www.nabble.com/Why-doesn%27t-os.system%28command%29-work--tf4283613.html#a12194312
Sent from the Zope - General mailing list archive at Nabble.com.

___
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 )