On Tuesday 04 July 2006 09:22, le dahut wrote: > Yes, I used already something like : > """ > import commands > > estim = commands.getoutput('/bin/echo -e "estimate > level=%s\n1"|/usr/sbin/bconsole -c > /etc/bacula/bconsole.conf'%niveau).split('bytes=') > """ > > ;-) If it can help someone else ...
Nice. Would you mind if I add it as an example of running Bacula commands in the default Bacula Python script? > > > K. > > Kern Sibbald a écrit : > > On Monday 03 July 2006 17:09, le dahut wrote: > >> Ok, everything works fine now. > >> > >> Another question, is it possible to get an estimation via python > >> Scripting > > > > If you mean can the Python script run a console "estimate" command, the > > answer is: no, not directly as the only "command" that Python can run is > > the "run" command. I will probably implement a general command interface > > at sometime in the future, but it is likely there will be some crazy > > recursion problems. > > > > However, Python can very well run *any* command by simply running a > > system() of the bconsole program and feeding it any commands you want. > > It is not very elegant, but possible. > > > >> ? > >> > >> > >> K. > >> > >> Kern Sibbald a écrit : > >>> On Monday 03 July 2006 13:24, le dahut wrote: > >>>> Hello, > >>>> > >>>> Bacula 1.38.10 RPM compiled successfully with the option > >>>> --with-python. > >>>> > >>>> But in a python prompt I get this : > >>>> >>> import sys, bacula > >>>> > >>>> Traceback (most recent call last): > >>>> File "<stdin>", line 1, in ? > >>>> ImportError: No module named bacula > >>>> > >>>> > >>>> > >>>> Any idea ? > >>> > >>> If you are at a Python prompt, you are probably using the Python > >>> interpreter directly. > >>> > >>> The bacula module is *only* available when Bacula calls Python, and in > >>> that case, there is no python prompt and no way to feed commands > >>> directly into the Bacula python instance. Everything works by Bacula > >>> generating "events" which cause the appropriate Bacula python method to > >>> be called ... > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users