Hey David,

I've seen your emails about the lib-dynload matter.
I think it is you who I sent my answer last week.
Do you still have it? Any questions?
The principle of my workaround is this:
Take your development script and let it create the values you need for bacula.
Then just let the DirStartUp.py call (not import!!!) this script and take the resulting values in for further processing.
So you will have two scripts:
One that does all the stuff where the shared modules from lib-dynload are needed, and...
The DirStartUp.py , which just receives the values (that it can't create itself) from the above script.

Mit freundlichem Gruß

i. A. Christoff Buch

=====================================
[EMAIL PROTECTED]
+49.941.78004.607

[EMAIL PROTECTED]
OneVision Software AG
Dr.-Leo-Ritter-Str. 9
D - 93049 Regensburg



Kern Sibbald <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

12.06.2006 19:30

To
"Wilson, David" <[EMAIL PROTECTED]>
cc
bacula-users@lists.sourceforge.net
Subject
Re: [Bacula-users] Python Question





On Monday 12 June 2006 19:03, Wilson, David wrote:
> The script that I am trying to use works fine running as root, and with
> the import time command I am using within the DirStartUp.py.
>
> I only run into this problem when bacula attempts to import this script.
> Bacula is running as root (at this time) so it should have all the
> rights I used when writing the original script I used for development.
>
> I think I received an email from another user stating that they
> experienced the problem before as well and it had something to do with
> dyn-load modules.
>
> Do you have any other ideas??

I am not a Python expert, so I cannot be of much help.  You might take a look
on the Python site or ask on their mailing list.  I see the same problem
here, and after looking at the error message a bit more carefully, I do see
that it is a problem with dynamically loaded modules because it is apparently
expecting the Python interpreter to be loaded in the normal fashing.  The
problem is that it is not finding PyInt_FromLong, which is part of the Python
interpreter, and the symbol is probably lost when Bacula is linked.

Your best bet is either to turn off dynamic modules, if that is possible, or
ask on the Python email list how to get around this.

>
> David Wilson
> Network Security Engineer
> PAETEC Communications, Inc.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Kern
> Sibbald
> Sent: Monday, June 12, 2006 11:22 AM
> To: Wilson, David
> Cc: bacula-users@lists.sourceforge.net
> Subject: Re: [Bacula-users] Python Question
>
> On Monday 12 June 2006 16:08, Wilson, David wrote:
> > I ran the director in a shell and this was the output I received.
> >
> > bacula-dir: dird.c:128 Debug level = 1
> > Traceback (most recent call last):
> >   File "/etc/bacula/scripts/DirStartUp.py", line 6, in ?
> >     import time, sys, bacula
> > ImportError: /usr/lib/python2.3/lib-dynload/timemodule.so: undefined
> > symbol: PyInt_FromLong
> > bkup1-roc-dir: pythonlib.c:134 Python Import error.
>
> Oh, it is nice that it worked.  I'll add that trick to the manual.
> Note, once
> you get the DirStartUp script to load, Bacula should be able to print
> all the
> Python errors, so this trick, in principle, should not be necessary
> if/when
> you have problems later.
>
> > It looks to be due to the fact I want to import the time module into
>
> the
>
> > script.  Is there any reason why I shouldn't be able to use external
> > modules??
>
> Yes, you can perfectly well use external modules, in fact the "sys"
> module
> that the script calls is external.  The problem is that apparently, you
> have
> not loaded all parts of the Python time module.  I suggest you try
> writing a
> small external Python script that you call that does what you want --
> running
> it directly with Python, then once you get it working, integrate it with
>
> Bacula.  Don't forget if you are running under root or some other user,
> Bacula may or may not have the right paths defined.
>
> > David Wilson
> > Network Security Engineer
> > PAETEC Communications, Inc.
> >
> > -----Original Message-----
> > From: Kern Sibbald [mailto:[EMAIL PROTECTED]
> > Sent: Monday, June 12, 2006 9:54 AM
> > To: Wilson, David
> > Cc: bacula-users@lists.sourceforge.net
> > Subject: Re: [Bacula-users] Python Question
> >
> > On Monday 12 June 2006 14:15, Wilson, David wrote:
> > > I just finished reading through the dev manual and I checked to make
> > > sure that the following is true:
> > >
> > > 1. The director can write to the directory, and is creating a
> > > DirStartUp.pyc file.
> > > 2. Any functions I do not want have been removed, or the noop=1 has
> >
> > been
> >
> > > placed within the event.
> > >
> > > Is there any way to get more detail other than the error messages I
>
> am
>
> > > seeing?  Seeing I cannot run the file from the command line to see
>
> if
>
> > it
> >
> > > is syntax problem, it would be nice to find out why bacula cannot
>
> use
>
> > > the file.
> >
> > Manually run the Director with the -d1 option on the command line in a
> > shell
> > window, and if you are lucky, the Python error message associated with
> > the
> > problem will be printed in the shell.
> >
> > Otherwise, start with the example files unchanged and make sure that
>
> the
>
> > script file has totally open permissions.  That should get it working,
> > afterwards you can make changes a bit at a time until you get what you
> > want.
> >
> > > Thanks,
> > >
> > > David Wilson
> > > Network Security Engineer
> > > PAETEC Communications, Inc.
> > >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of
>
> Kern
>
> > > Sibbald
> > > Sent: Saturday, June 10, 2006 11:16 AM
> > > To: bacula-users@lists.sourceforge.net
> > > Cc: Wilson, David
> > > Subject: Re: [Bacula-users] Python Question
> > >
> > > On Friday 09 June 2006 21:21, Wilson, David wrote:
> > > > Greetings,
> > > >
> > > >
> > > >
> > > > I am working with using the python functionality of bacula and I
>
> am
>
> > > > running into a problem with the DirStartUp.py script.
> > > >
> > > >
> > > >
> > > > Whenever I startup bacula, or restart the python engine I receive
> >
> > the
> >
> > > > following error:
> > > >
> > > >
> > > >
> > > > 09-Jun 15:14 bkup1-roc-dir: ERROR in pythonlib.c:131 Could not
> >
> > import
> >
> > > > Python script /etc/bacula/scripts/DirStartUp. Python disabled.
> > > >
> > > >
> > > >
> > > > When I attempt to run the script manually I receive:
> > > >
> > > > Traceback (most recent call last):
> > > >
> > > >   File "DirStartUp.py", line 6, in ?
> > > >
> > > >     import sys, bacula, time
> > > >
> > > > ImportError: No module named bacula
> > > >
> > > >
> > > >
> > > > I did compile bacula with -with-python and I received no errors
> >
> > while
> >
> > > > installing in.
> > > >
> > > >
> > > >
> > > > Any ideas??
> > >
> > > Please see the Python chapter of the development manual -- in
> >
> > particular
> >
> > > the
> > > Python Configuration section. I have added several paragraphs that
> > > explain
> > > this problem.
> > >
> > > http://www.bacula.org/dev-manual/Python_Scripting.html
> > >
> > > > David Wilson
> > > > Network Security Engineer
> > > > PAETEC Communications, Inc.

--
Best regards,

Kern

 (">
 /\
 V_V


_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to