[Chimera-users] [External] import error from module: Togl

Tom Goddard goddard at sonic.net
Fri Jul 25 11:13:56 PDT 2014


Hi Mike,

  Ok, so “set bgTransparency” is causing the error, because that code imports tkgui.py.  To make an image with a transparent background Chimera requests a rendering framebuffer that remembers the transparency of every pixel.  It is trying to tell the graphics window to switch to a framebuffer that has an alpha channel.  This is a bit strange because Chimera image saving does not draw to the graphics window — instead it draws to an off-screen framebuffer, and it is that framebuffer that needs the alpha channel.  With the “headless” Chimera it is always drawing to an off-screen framebuffer.  I think this code would be simple to fix, but Chimera developer Greg Couch is the one who knows most about image saving and would be the one to do that.  There is a complication that some ancient graphics doesn’t offer off-screen framebuffers and in Chimera in GUI mode the image saving does need to change the window framebuffer in order to have transparent background, so probably we can’t just eliminate that code, but maybe it just needs to not be called when in nogui mode.  Greg will advise.

	Tom



> From: Mike Sivley 
> Subject: Re: [Chimera-users] [External] import error from module: Togl
> Date: July 25, 2014 at 10:32:21 AM PDT
> To: Tom Goddard 
> 
> Thanks for the prompt reply, Tom. The script is called by another script, and so part of the traceback was getting lost. When I called it from the command-line I received the entire traceback. I've copied it at the bottom of this email, but while trying to reproduce the exception, I found the specific command which was causing issues: bgTransparency. I'm still not certain why this is suddenly causing an exception when previously it did not, but at least for my immediate purposes I can avoid the issue by sticking with a white background in the script and then manually setting the transparency from a Windows copy of chimera.
> 
> Any ideas as to why this particular command fails in linux/without the gui? Thanks for setting me on the right track!
> 
> > set bgTransparency
> Traceback (most recent call last):
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/ReadStdin/__init__.py", line 79, in _runCommand
>    chimera.runCommand(cmd)
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/__init__.py", line 2663, in runCommand
>    makeCommand(*args, **kw)
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/Midas/midas_text.py", line 69, in makeCommand
>    f(c, args)
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/Midas/midas_text.py", line 2356, in doSet
>    cmd()
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/Midas/__init__.py", line 2946, in setBgTransparency
>    printer.setTransparentBackground(True, updateGUI=True)
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/printer.py", line 1030, in setTransparentBackground
>    from tkgui import app
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/tkgui.py", line 73, in <module>
>    import Togl
> ImportError: No module named Togl
> 
> ImportError: No module named Togl
> 
>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/tkgui.py", line 73, in <module>
>    import Togl
> 
> Mike
> 
> 
> On 7/25/2014 12:06 PM, Tom Goddard wrote:
>> Hi Mike,
>> 
>>   Chimera does not use your system Python nor does it use your system Python libraries normally.  But maybe it is seeing those because you have an environment variable, maybe PYTHONPATH set.  If you are running a bash shell on linux try the “set” command to list all the environment variables before running Chimera and see if anything specific to python appears.
>> 
>>   Does chimera start without any command-line options?
>> 
>>   You are right that it is strange that tkgui.py is being imported since that shouldn’t happen when using the —nogui flag.  But possibly your script is calling some Chimera functionality that imports tkgui.py (even in nogui mode), hard to say without seeing your script.  Also it would be much clearer if we had a full traceback showing all the function calls leading to the error — Python usually prints that, did it not give the full traceback in your case?
>> 
>> 	Tom
>> 
>> 
>> On Jul 25, 2014, at 9:28 AM, Mike Sivley wrote:
>> 
>>> I apologize in advance if this becomes too system-specific, as I believe an automatic update of our server's python libraries may be to blame for this error. However, my hope is that others may have run into the issue as well and have already found a solution.
>>> 
>>> I have a python/chimera script that generates Chimera scenes with various annotations assigned to residues in a protein structure. This script worked without issue for several weeks. I returned from a week of vacation and now the script fails with the following error:
>>> 
>>> ImportError: No module named Togl
>>> 
>>>  File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/tkgui.py", line 73, in <module>
>>>    import Togl
>>> 
>>> Togl appears to be a deprecated library, so my best guess is that it was removed during some automatic update (possibly of PyOpenGL?) applied to our servers. However, Chimera is distributed with its own python executable and libraries, so I'm unsure how this type of change could have affected it. I am using the nightly headless linux build of Chimera from 05-13-2014. I have reinstalled chimera from the original .bin file, and I have also installed the most recent nightly headless build. Neither resolved the issue. I'm additionally confused because the exception is raised by tkgui.py, which by naming convention seems like it shouldn't even be called given that I am passing the "--nogui --silent --script" parameters to chimera.
>>> 
>>> The specific call to chimera is this:
>>> 
>>> chimera --nogui --silent --script 'lib/PDBMapVisualize.py 1hho 1 maf temp/61098856282.TEMP 1.000000 0.000000 data/rcsb/biounit/coordinates/all/1hho.pdb1.gz results/pdbmap_1kg_1hho_20140725-11 -'
>>> 
>>> Where lib/PDBMapVisualize.py is my script and everything following are arguments to that script. Nothing about this call or the script it is calling have changed between when chimera ran successfully and now.
>>> 
>>> Any help or advice in resolving this issue would be greatly appreciated. Thanks!
>>> 
>>> Mike Sivley
>>> PhD Student in Biomedical Informatics
>>> Center for Human Genetics Research
>>> Vanderbilt University Medical Center
>>> _______________________________________________
>>> Chimera-users mailing list
>>> Chimera-users at cgl.ucsf.edu
>>> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>>> 
> 
wrote:

> Hi Mike,
> 
>  Chimera does not use your system Python nor does it use your system Python libraries normally.  But maybe it is seeing those because you have an environment variable, maybe PYTHONPATH set.  If you are running a bash shell on linux try the “set” command to list all the environment variables before running Chimera and see if anything specific to python appears.
> 
>  Does chimera start without any command-line options?
> 
>  You are right that it is strange that tkgui.py is being imported since that shouldn’t happen when using the —nogui flag.  But possibly your script is calling some Chimera functionality that imports tkgui.py (even in nogui mode), hard to say without seeing your script.  Also it would be much clearer if we had a full traceback showing all the function calls leading to the error — Python usually prints that, did it not give the full traceback in your case?
> 
> 	Tom
> 
> 
> On Jul 25, 2014, at 9:28 AM, Mike Sivley wrote:
> 
>> I apologize in advance if this becomes too system-specific, as I believe an automatic update of our server's python libraries may be to blame for this error. However, my hope is that others may have run into the issue as well and have already found a solution.
>> 
>> I have a python/chimera script that generates Chimera scenes with various annotations assigned to residues in a protein structure. This script worked without issue for several weeks. I returned from a week of vacation and now the script fails with the following error:
>> 
>> ImportError: No module named Togl
>> 
>> File "/ant2/Bush_eQTL/sivleyrm/bin/UCSF-Chimera64-2014-05-13/share/chimera/tkgui.py", line 73, in <module>
>>   import Togl
>> 
>> Togl appears to be a deprecated library, so my best guess is that it was removed during some automatic update (possibly of PyOpenGL?) applied to our servers. However, Chimera is distributed with its own python executable and libraries, so I'm unsure how this type of change could have affected it. I am using the nightly headless linux build of Chimera from 05-13-2014. I have reinstalled chimera from the original .bin file, and I have also installed the most recent nightly headless build. Neither resolved the issue. I'm additionally confused because the exception is raised by tkgui.py, which by naming convention seems like it shouldn't even be called given that I am passing the "--nogui --silent --script" parameters to chimera.
>> 
>> The specific call to chimera is this:
>> 
>> chimera --nogui --silent --script 'lib/PDBMapVisualize.py 1hho 1 maf temp/61098856282.TEMP 1.000000 0.000000 data/rcsb/biounit/coordinates/all/1hho.pdb1.gz results/pdbmap_1kg_1hho_20140725-11 -'
>> 
>> Where lib/PDBMapVisualize.py is my script and everything following are arguments to that script. Nothing about this call or the script it is calling have changed between when chimera ran successfully and now.
>> 
>> Any help or advice in resolving this issue would be greatly appreciated. Thanks!
>> 
>> Mike Sivley
>> PhD Student in Biomedical Informatics
>> Center for Human Genetics Research
>> Vanderbilt University Medical Center
>> _______________________________________________
>> Chimera-users mailing list
>> Chimera-users at cgl.ucsf.edu
>> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140725/3d9a495d/attachment.html>


More information about the Chimera-users mailing list