Re: [Zope] Problems Executing pdftk from within zope.

2006-04-11 Thread Dieter Maurer
Chris Withers wrote at 2006-4-10 18:16 +0100:
Jerry Westrick wrote:
 When executed from within zope, 
 (this i've done via external command that executes os.system(...))
 A task is started to executed it, but the task hangs.

os.system will spew to stdout, which a daemon process like Zope probably 
won't enjoy much.

If Zope really runs as daemon (on *nix), stdout and stderr
are redirected to /dev/null. Output will simply be discarded.

By the way, stdin will be /dev/null, too.

-- 
Dieter
___
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] Problems Executing pdftk from within zope.

2006-04-10 Thread Chris Withers

Jerry Westrick wrote:
When executed from within zope, 
(this i've done via external command that executes os.system(...))

A task is started to executed it, but the task hangs.


os.system will spew to stdout, which a daemon process like Zope probably 
won't enjoy much.


If'd suggest moving to Zope 2.9, and then using Ptyon 2.4's subprocess 
module which handles these kinda things much better.


Also, I echo Dieter's comments on stuff that needs to be run as root...

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

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


SOLVED Re: [Zope] Problems Executing pdftk from within zope.

2006-04-10 Thread Jerry Westrick
On Sunday 09 April 2006 19.33, Dieter Maurer wrote:
 Jerry Westrick wrote at 2006-4-8 22:35 +0200:
  ...
 I bet this is the problem...
 What should the Sigmask look like?

 If the Python bug is fixed, nothing is blocked.
 If the Python bug is still there, all blockable signals (i.e. all with
 the exception of SIGKILL and SIGSTOP) are blocked.


Yep, this is the problem
sorry about the send single line comments,
my fingers are automatically adding new lines to the
IM

All these different communication programs are giving me keys on the brain 8-(

But all the  signals are set, so this is the problem...
Thanks, everyone for your help to get me past this one,
as it really had me stumped

I hereby to issue: 
30 karma points to Dieter...
20 to Chris
10 to 

8-)


Thx...

Jerry


  ...
 Hmm I'll look into this also, although Zope requires specefic versions...

 Not precise versions only precise series.
___
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] Problems Executing pdftk from within zope.

2006-04-08 Thread Jerry Westrick
On Saturday 08 April 2006 01.24, Jonathan wrote:
 Have you tried running it as a spawned job from the shell?  If something is
 pooched in the environment then the job should hang (then you know it is
 not a zope problem).

 Jonathan


Using the if __name__ == '__main__': main()
I have executed the command from the External script file
(as user root) with python aw4.py ecmd2 and it works...

But when called from zope it hangs...

I've tried with popen(...)
and spawnv(...)

I've had the script dump the environment variables
and the version dumped by root, differs from the version 
dumped from zope only in variables with cookie in them!

Now I tried to do a simple cat  and it don't seam to work either...

I'm quite fustrated so it's time to go have fun (install SUSE 10 XEN on SUSE 
10   Whp!).

If anyone, anywhere has any ideas WTF is going on here,
please give me a hint!


Jerry




___
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] Problems Executing pdftk from within zope.

2006-04-08 Thread Jonathan
Don't know if this will help, but here is a line from one of my external 
methods that works:


   rstat = commands.getstatusoutput('./qrcode '+quoted_instr)

'qrcode' is a bash script file (linux) that resides in '/apps/zope/var' (no 
messing around with PATH or environment variables) and takes a string 
'quoted_instr' as an input parameter.


if you do 'return str(rstat)'  after the call you should get some error info 
if the call fails.


HTH

Jonathan


- Original Message - 
From: Jerry Westrick [EMAIL PROTECTED]

To: zope@zope.org
Sent: Saturday, April 08, 2006 10:47 AM
Subject: Re: [Zope] Problems Executing pdftk from within zope.



On Saturday 08 April 2006 01.24, Jonathan wrote:
Have you tried running it as a spawned job from the shell?  If something 
is

pooched in the environment then the job should hang (then you know it is
not a zope problem).

Jonathan



Using the if __name__ == '__main__': main()
I have executed the command from the External script file
(as user root) with python aw4.py ecmd2 and it works...

But when called from zope it hangs...

I've tried with popen(...)
and spawnv(...)

I've had the script dump the environment variables
and the version dumped by root, differs from the version
dumped from zope only in variables with cookie in them!

Now I tried to do a simple cat  and it don't seam to work either...

I'm quite fustrated so it's time to go have fun (install SUSE 10 XEN on 
SUSE

10   Whp!).

If anyone, anywhere has any ideas WTF is going on here,
please give me a hint!


Jerry




___
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 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] Problems Executing pdftk from within zope.

2006-04-08 Thread Dieter Maurer
Jerry Westrick wrote at 2006-4-8 00:42 +0200:
I trying to modify pdf files from within zope.
I use the following command:

'/usr/bin/pdftk /t/in.pdf attach_files /t/a1.pdf /t/a2.pdf output /t/out.pdf'

When I execute it as root it works...

I do not know what pdftk does.
But from your description, it would be really strange when it required
execution as root. If it really does, I would say: do not use it!

When executed from within zope, 
(this i've done via external command that executes os.system(...))
A task is started to executed it, but the task hangs.

Apart from the most recent Python versions, earlier Python versions
had a bug: forked processes from multi-threaded applications (such
as Zope) had all signals blocked. Thus, when a forked application
used signals (e.g. alarm), it could hang.
Checking the sigmask of the application can tell you whether
this problem still exists with your Python version.


The most recent Python versions in the 2.3 and 2.4 series should have
this problem fixed.


-- 
Dieter
___
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] Problems Executing pdftk from within zope.

2006-04-08 Thread Jerry Westrick
On Saturday 08 April 2006 20.47, Dieter Maurer wrote:
 Jerry Westrick wrote at 2006-4-8 00:42 +0200:
 I trying to modify pdf files from within zope.
 I use the following command:
 
 '/usr/bin/pdftk /t/in.pdf attach_files /t/a1.pdf /t/a2.pdf output
  /t/out.pdf'
 
 When I execute it as root it works...

 I do not know what pdftk does.
 But from your description, it would be really strange when it required
 execution as root. If it really does, I would say: do not use it!

 When executed from within zope,
 (this i've done via external command that executes os.system(...))
 A task is started to executed it, but the task hangs.

 Apart from the most recent Python versions, earlier Python versions
 had a bug: forked processes from multi-threaded applications (such
 as Zope) had all signals blocked. Thus, when a forked application
 used signals (e.g. alarm), it could hang.
 Checking the sigmask of the application can tell you whether
 this problem still exists with your Python version.

Ahhh, I bet this is the problem...


 The most recent Python versions in the 2.3 and 2.4 series should have
 this problem fixed.
___
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] Problems Executing pdftk from within zope.

2006-04-08 Thread Jerry Westrick
On Saturday 08 April 2006 20.47, Dieter Maurer wrote:
 Jerry Westrick wrote at 2006-4-8 00:42 +0200:
 I trying to modify pdf files from within zope.
 I use the following command:
 
 '/usr/bin/pdftk /t/in.pdf attach_files /t/a1.pdf /t/a2.pdf output
  /t/out.pdf'
 
 When I execute it as root it works...

 I do not know what pdftk does.
 But from your description, it would be really strange when it required
 execution as root. If it really does, I would say: do not use it!

 When executed from within zope,
 (this i've done via external command that executes os.system(...))
 A task is started to executed it, but the task hangs.

 Apart from the most recent Python versions, earlier Python versions
 had a bug: forked processes from multi-threaded applications (such
 as Zope) had all signals blocked. Thus, when a forked application
 used signals (e.g. alarm), it could hang.
 Checking the sigmask of the application can tell you whether
 this problem still exists with your Python version.


I bet this is the problem...
What should the Sigmask look like?

Later on tonight, I'll publish what the values are,
and what versions of python I'm using...



 The most recent Python versions in the 2.3 and 2.4 series should have
 this problem fixed.


Hmm I'll look into this also, although Zope requires specefic versions...


Thx...
Jerry

P.S. Sorry about the preveous post

___
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] Problems Executing pdftk from within zope.

2006-04-07 Thread Jerry Westrick
Hello Zopistas...

I trying to modify pdf files from within zope.
I use the following command:

'/usr/bin/pdftk /t/in.pdf attach_files /t/a1.pdf /t/a2.pdf output /t/out.pdf'

When I execute it as root it works...

When executed from within zope, 
(this i've done via external command that executes os.system(...))
A task is started to executed it, but the task hangs.

Even with set the setuid bit on /usr/bin/pdftk, making the zope spawned task 
run as root the command just hangs
(I've confirmed that the task is actually running as root!)

I'm sure I've forgoten something silly,
but after bashing it around for several hours I just can't figure out
why it hangs

Any suggestions at what the problem could be are welcome 8-)

Jerry
P.S. Here my Control panel info, incase it's relevant


Zope Version(unreleased version, python 2.3.4, linux2)
Python Version  2.3.4 (#1, Oct 5 2004, 00:26:51) [GCC 3.3.4 (pre 3.3.5 
20040809)]

System Platform linux2
SOFTWARE_HOME   /opt/zope/lib/python
ZOPE_HOME   /opt/zope
INSTANCE_HOME   /var/opt/zope/default
CLIENT_HOME /var/opt/zope/default/var
Network Services
ZServer.HTTPServer.zhttp_server (Port: 8080)
ZServer.FTPServer.FTPServer (Port: 8021)
ZServer.HTTPServer.zhttp_server (Port: 8088)
Process Id  32058 (1110281136)
Running For 12 min 58 sec 
___
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] Problems Executing pdftk from within zope.

2006-04-07 Thread Jonathan
Have you tried running it as a spawned job from the shell?  If something is 
pooched in the environment then the job should hang (then you know it is not 
a zope problem).


Jonathan

- Original Message - 
From: Jerry Westrick [EMAIL PROTECTED]

To: Zope@zope.org
Sent: Friday, April 07, 2006 6:42 PM
Subject: [Zope] Problems Executing pdftk from within zope.



Hello Zopistas...

I trying to modify pdf files from within zope.
I use the following command:

'/usr/bin/pdftk /t/in.pdf attach_files /t/a1.pdf /t/a2.pdf output 
/t/out.pdf'


When I execute it as root it works...

When executed from within zope,
(this i've done via external command that executes os.system(...))
A task is started to executed it, but the task hangs.

Even with set the setuid bit on /usr/bin/pdftk, making the zope spawned 
task

run as root the command just hangs
(I've confirmed that the task is actually running as root!)

I'm sure I've forgoten something silly,
but after bashing it around for several hours I just can't figure out
why it hangs

Any suggestions at what the problem could be are welcome 8-)

Jerry
P.S. Here my Control panel info, incase it's relevant


Zope Version (unreleased version, python 2.3.4, linux2)
Python Version 2.3.4 (#1, Oct 5 2004, 00:26:51) [GCC 3.3.4 (pre 3.3.5
20040809)]

System Platform linux2
SOFTWARE_HOME /opt/zope/lib/python
ZOPE_HOME /opt/zope
INSTANCE_HOME /var/opt/zope/default
CLIENT_HOME /var/opt/zope/default/var
Network Services
ZServer.HTTPServer.zhttp_server (Port: 8080)
ZServer.FTPServer.FTPServer (Port: 8021)
ZServer.HTTPServer.zhttp_server (Port: 8088)
Process Id 32058 (1110281136)
Running For 12 min 58 sec
___
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 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 )