I get this output from cmd.get_version

Open pymol:

version: 1.7.0.0 (1.700) 1700, Open-Source

Incentive pymol:
  version: 1.7 (1.700) 1700, Incentive Product


You could ude this, or not?

On 10/3/14 3:06 PM, Andreas Warnecke wrote:
> Hi all,
>
> just to specify the issue: the problem is not the crash, because the
> script continues due to the try statement. The issue is that PyMOL
> handles and prints the exception from the 'alter' command into the
> console. I would like to avoid that, either by testing incentive vs.
> open-source, or by preventing PyMOL from printing the exception.
>
> The cmd.get_version() command can be used to test the version of PyMOL,
> but does to my knowledge not give information on the
> incentive/open-source build (?).
>
> It would be useful to have a way of testing this, though. Ideas anyone?
>
> Currently, I solved the issue with the printing like this now, but I
> feel it is inferior to actually testing the incentive/open-source state:
>
> try:
>      originalstdout = sys.stdout # hijack the output
>      sys.stdout = sys.stdout = open('/dev/null', 'w') # dump
>      cmd.alter('...') # longer command omitted here - error usually
> printed here
>      sys.stdout = originalstdout # reinstate the output
> except: pass
>
> Thanks for the suggestions,
>
> Andreas
>
> On Fri, Oct 3, 2014 at 2:59 PM, Gianluca Santoni
> <gianluca.sant...@ibs.fr <mailto:gianluca.sant...@ibs.fr>> wrote:
>
>     Version number is printed in the startup message, so it has to be stored
>     somewere related to this function.
>
>     On 10/3/14 2:23 PM, Tsjerk Wassenaar wrote:
>     > Hi Andreas,
>     >
>     > Ah, I think the problem is PyMOL handling the error. It probably prints
>     > the exception and then continuous anyway. So it actually doesn't allow
>     > you to catch it off. So you would indeed need to get access to the
>     > version. I don't know where that is stored from the top of my head.
>     > Maybe Thomas knows.
>     >
>     > Cheers,
>     >
>     > Tsjerk
>     >
>     > On Fri, Oct 3, 2014 at 2:09 PM, Andreas Warnecke
>     > <4ndreas.warne...@gmail.com <mailto:4ndreas.warne...@gmail.com>
>     <mailto:4ndreas.warne...@gmail.com
>     <mailto:4ndreas.warne...@gmail.com>>> wrote:
>     >
>     >     Hi,
>     >
>     >     Thanks for the reply. I'm just having the issue that even if I place
>     >     the code in a try statement the error output shows in the PyMOL
>     >     console, but the script proceeds anyhow.
>     >     Is there anyway of intercepting/silencing this output?
>     >
>     >     Thanks,
>     >
>     >     Andreas
>     >
>     >     On Fri, Oct 3, 2014 at 1:46 PM, Tsjerk Wassenaar <tsje...@gmail.com 
> <mailto:tsje...@gmail.com>
>     >     <mailto:tsje...@gmail.com <mailto:tsje...@gmail.com>>> wrote:
>     >
>     >         Hi Andreas,
>     >
>     >         A try/except block is actually a very pythonic way of dealing
>     >         with such issues. You can catch the error with an except clause,
>     >         that allows executing some code in case the other thing didn't
>     >         work out. Make sure to only catch the error that is raised by
>     >         what you're trying, otherwise you may interfere with the normal
>     >         functioning of things (like catching a termination signal).
>     >
>     >         Hope it helps,
>     >
>     >         Tsjerk
>     >
>     >         On Fri, Oct 3, 2014 at 1:35 PM, Andreas Warnecke
>      >         <4ndreas.warne...@gmail.com
>     <mailto:4ndreas.warne...@gmail.com>
>     <mailto:4ndreas.warne...@gmail.com <mailto:4ndreas.warne...@gmail.com>>>
>      >         wrote:
>      >
>      >             Dear PyMOL users,
>      >
>      >             I am wondering if there is any way of testing whether a
>      >             PyMOL version is open-source or incentive for use in
>      >             scripts. I'm thinking of something similar to
>      >             'cmd.get_version()'.
>      >
>      >             The reason for this is that I am e.g. using the 'alter'
>      >             command on custom properties in scripts, which is a
>     feature
>      >             that may not be available in all PyMOL versions. At the
>      >             moment I avoid a crash by placing the code within a 'try'
>      >             statement, but this will yield an error message. If I
>     could
>      >             actually test the incentive/open-source state this would
>      >             allow me to use an 'if' statement instead and avoid the
>      >             error message.
>      >
>      >             I would welcome suggestions on how to approach this.
>      >
>      >             Thanks,
>      >
>      >             Andreas
>      >
>      >
>       
> ------------------------------------------------------------------------------
>      >             Meet PCI DSS 3.0 Compliance Requirements with
>     EventLog Analyzer
>      >             Achieve PCI DSS 3.0 Compliant Status with
>     Out-of-the-box PCI
>      >             DSS Reports
>      >             Are you Audit-Ready for PCI DSS 3.0 Compliance? Download
>      >             White paper
>      >             Comply to PCI DSS 3.0 Requirement 10 and 11.5 with
>     EventLog
>      >             Analyzer
>      >
>     
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>      >             _______________________________________________
>      >             PyMOL-users mailing list
>     (PyMOL-users@lists.sourceforge.net
>     <mailto:PyMOL-users@lists.sourceforge.net>
>      >             <mailto:PyMOL-users@lists.sourceforge.net
>     <mailto:PyMOL-users@lists.sourceforge.net>>)
>     >             Info Page:
>     >https://lists.sourceforge.net/lists/listinfo/pymol-users
>     >             Archives:
>     >http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>     >
>     >
>     >
>     >
>     >         --
>     >         Tsjerk A. Wassenaar, Ph.D.
>     >
>     >
>     >
>     >
>     >
>     > --
>     > Tsjerk A. Wassenaar, Ph.D.
>     >
>     >
>     >
>     > 
> ------------------------------------------------------------------------------
>     > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>     > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>     > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>     > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>     
> >http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>     >
>     >
>     >
>     > _______________________________________________
>     > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net
>     <mailto:PyMOL-users@lists.sourceforge.net>)
>     > Info Page:https://lists.sourceforge.net/lists/listinfo/pymol-users
>     > Archives:http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>     >
>
>
>     --
>     Gianluca Santoni,
>     Dynamop Group
>     Institut de Biologie Structurale
>     6 rue Jules Horowitz
>     38027 Grenoble Cedex 1
>     France
>     _________________________________________________________
>     Please avoid sending me Word or PowerPoint attachments.
>     See http://www.gnu.org/philosophy/no-word-attachments.html
>
>     
> ------------------------------------------------------------------------------
>     Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>     Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>     Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>     Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>     
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>     _______________________________________________
>     PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net
>     <mailto:PyMOL-users@lists.sourceforge.net>)
>     Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>     Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
>


-- 
Gianluca Santoni,
Dynamop Group
Institut de Biologie Structurale
6 rue Jules Horowitz                                                    
38027 Grenoble Cedex 1                                          
France  
_________________________________________________________
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to