Re: [Zope] external method: importing and updating method

2006-10-05 Thread Chris Withers

Alan wrote:

Thanks for help. I did what suggested below. We also set a crontab to
restart the zope server every night,


Why?!

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 )


Re: Re: [Zope] external method: importing and updating method

2006-10-05 Thread Alan

Hi List,

crontab is really a bad idea. We quitted that.

Thanks for your commentaries.

Alan

On 05/10/06, Chris Withers [EMAIL PROTECTED] wrote:

Alan wrote:
 Thanks for help. I did what suggested below. We also set a crontab to
 restart the zope server every night,

Why?!

Chris

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





--
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28

___
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: Re: [Zope] external method: importing and updating method

2006-10-05 Thread Andreas Jung



--On 5. Oktober 2006 10:24:31 +0100 Alan [EMAIL PROTECTED] wrote:


Hi List,

crontab is really a bad idea. We quitted that.



Why is using crontab a bad idea?

It's the most common and most reliable solution to run scripts in Zope 
periodically.


-aj

pgpHnQfkHcCKi.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] external method: importing and updating method

2006-10-05 Thread Pascal Peregrina
Well the complete story was:
We also set a crontab to restart the zope server every night, but them I
was wondering if it is a good idea.
And later on:
crontab is really a bad idea. We quitted that.

And in that case (using crontab to restart Zope every night), I think it was
a bad idea.

Of course, for stuff like starting some processing at a given time in the
Zope instance, crontab can be great... Well, there is also this interesting
on-going thread about TimerService/ZopeScheduler :))

Pascal


 De : Jens Vagelpohl [EMAIL PROTECTED]
 Date : Thu, 5 Oct 2006 08:03:53 -0400
 À : zope Mailing List zope@zope.org
 Objet : Re: [Zope] external method: importing and updating method
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 
 On 5 Oct 2006, at 05:24, Alan wrote:
 
 Hi List,
 
 crontab is really a bad idea. We quitted that.
 
 Might make sense to back up blanket nonsensical statements like that
 with some hard facts.
 
 jens
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.1 (Darwin)
 
 iD8DBQFFJPSqRAx5nvEhZLIRAkKWAJ45fYr4khMmREaF89vfFJEGvo2v3gCfSe8g
 bXYxESSH8t4mi4nFmVWY67A=
 =wI9T
 -END 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 )



**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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: Re: [Zope] external method: importing and updating method

2006-10-04 Thread Alan

Hi Folks,

Thanks for help. I did what suggested below. We also set a crontab to
restart the zope server every night, but them I was wondering if it is
a good idea.

Cheers,
Alan

On 03/10/06, Jonathan [EMAIL PROTECTED] wrote:


- Original Message -
From: Dieter Maurer [EMAIL PROTECTED]
To: Alan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Tuesday, October 03, 2006 2:06 PM
Subject: Re: [Zope] external method: importing and updating method


 Alan wrote at 2006-10-2 18:48 +0100:
In my external method I have something like this:
...
sys.path.insert(0, CCPNPYTHON)

 This is not a good idea!

 The source of an External Method can be read arbitrarily often --
 and each time, you extend sys.path...

We get around this 'evergrowing' path problem by (if there is a problem with
this solution let me know!):

import sys
SOMEPATH = '/some/path/goes/here'
if SOMEPATH not in sys.path:
sys.path.append(SOMEPATH)


Jonathan






--
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28

___
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: Re: [Zope] external method: importing and updating method

2006-10-04 Thread Jonathan


- Original Message - 
From: Alan [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: Dieter Maurer [EMAIL PROTECTED]; zope@zope.org
Sent: Wednesday, October 04, 2006 6:12 AM
Subject: Re: Re: [Zope] external method: importing and updating method



Hi Folks,

Thanks for help. I did what suggested below. We also set a crontab to
restart the zope server every night, but them I was wondering if it is
a good idea.


What you are trying to accomplish/resolve by restarting zope everynight?  I 
can't think of any real downside to doing it, but it shouldn't be 
necessary - we once had a production server that ran for over 13 months, 
continuously, without ever being restarted! (now that's a stable platform!)



Jonathan


___
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: Re: [Zope] external method: importing and updating method

2006-10-04 Thread Lennart Regebro

On 10/4/06, Alan [EMAIL PROTECTED] wrote:

Thanks for help. I did what suggested below. We also set a crontab to
restart the zope server every night, but them I was wondering if it is
a good idea.


Isn't it better to just restart the server when you have updated the software?
Modules loaded from External methods are not different from any other
Zope software in that sense.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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] external method: importing and updating method

2006-10-03 Thread Dieter Maurer
Alan wrote at 2006-10-2 18:48 +0100:
In my external method I have something like this:
...
sys.path.insert(0, CCPNPYTHON)

This is not a good idea!

The source of an External Method can be read arbitrarily often --
and each time, you extend sys.path...

The imp module allows you to import modules without the need
to modify path.

 ...
the problem I am facing now it that if I update my memops stuff (which
is found in CCPNPYTHON path) it seems not to be being updated in Zope,
because Zope is still using the old version. (If I run outside Zope,
the code works).

That's typical Python behaviour:

  Python does not recognize at runtime when a module source has
  changed.

  It provides however a builtin reload which you can use
  to explicitely reload a module.

  Be warned the reload is dangerous. Funny effects can happen.


As someone else suggested, restarting Zope is the safest way
(although not the fasted one).



-- 
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] external method: importing and updating method

2006-10-03 Thread Jonathan


- Original Message - 
From: Dieter Maurer [EMAIL PROTECTED]

To: Alan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Tuesday, October 03, 2006 2:06 PM
Subject: Re: [Zope] external method: importing and updating method



Alan wrote at 2006-10-2 18:48 +0100:

In my external method I have something like this:
...
sys.path.insert(0, CCPNPYTHON)


This is not a good idea!

The source of an External Method can be read arbitrarily often --
and each time, you extend sys.path...


We get around this 'evergrowing' path problem by (if there is a problem with 
this solution let me know!):


import sys
SOMEPATH = '/some/path/goes/here'
if SOMEPATH not in sys.path:
   sys.path.append(SOMEPATH)


Jonathan 



___
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] external method: importing and updating method

2006-10-02 Thread Jonathan


- Original Message - 
From: Alan [EMAIL PROTECTED]

To: zope@zope.org
Sent: Monday, October 02, 2006 1:48 PM
Subject: [Zope] external method: importing and updating method



Hi List!

In my external method I have something like this:
...
sys.path.insert(0, CCPNPYTHON)
from memops.general.Io import loadXmlProjectFile
...

the problem I am facing now it that if I update my memops stuff (which
is found in CCPNPYTHON path) it seems not to be being updated in Zope,
because Zope is still using the old version. (If I run outside Zope,
the code works).


I have encountered this problem before, and the quick-fix was to restart 
Zope (from the ZMI - Control Panel).


hth

Jonathan


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