The APBS Tools plugin in pymol r4146 has problems running against python 3.4.3 or 3.5.0 using Pmw 2.0.0. In the case of python 3.4.3, the APBS Tools can successfully open a pre-existing pqr file but when "Set Grid" is clicked, the error...
SyntaxError Exception in Tk callback
Function: <function Dialog._buttons.<locals>.<lambda> at 0x109907c80> (type: <class 'function'>)
Args: ()
Traceback (innermost last):
File "/sw/lib/python3.4/site-packages/Pmw/Pmw_2_0_0/lib/PmwBase.py", line 1776, in __call__
return self.func(*args)
File "/sw/lib/python3.4/site-packages/Pmw/Pmw_2_0_0/lib/PmwDialog.py", line 152, in <lambda>
command=lambda self=self, name=name: self._doCommand(name))
File "/sw/lib/python3.4/site-packages/Pmw/Pmw_2_0_0/lib/PmwDialog.py", line 132, in _doCommand
return command(name)
File "/sw/lib/python3.4/site-packages/pmg_tk/startup/apbs_tools.py", line 1163, in execute
self.runPsize()
File "/sw/lib/python3.4/site-packages/pmg_tk/startup/apbs_tools.py", line 1202, in runPsize
psize = imp.load_module('psize',f,fname,description)
File "/sw/lib/python3.4/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/sw/lib/python3.4/imp.py", line 171, in load_source
module = methods.load()
File "<frozen importlib._bootstrap>", line 1220, in load
None
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
None
File "<frozen importlib._bootstrap>", line 1129, in _exec
None
File "<frozen importlib._bootstrap>", line 1467, in exec_module
None
File "<frozen importlib._bootstrap>", line 1572, in get_code
None
File "<frozen importlib._bootstrap>", line 1532, in source_to_code
None
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
None
SyntaxError: invalid syntax (psize.py, line 362)
appears. When pymol r4146 is built against python 3.5.0 instead, the failure occurs earllier when the APBS Tools plugin attempts to open its window...
TypeError Exception in Tk callback
Function: <function __init__.<locals>.<lambda> at 0x10c416c80> (type: <class 'function'>)
Args: ()
Traceback (innermost last):
File "/sw/lib/python3.5/site-packages/Pmw/Pmw_2_0_0/lib/PmwBase.py", line 1776, in __call__
return self.func(*args)
File "/sw/lib/python3.5/site-packages/pmg_tk/startup/apbs_tools.py", line 321, in <lambda>
command = lambda s=self: APBSTools2(s))
File "/sw/lib/python3.5/site-packages/pmg_tk/startup/apbs_tools.py", line 616, in __init__
self.notebook = Pmw.NoteBook(self.dialog.interior())
File "/sw/lib/python3.5/site-packages/Pmw/Pmw_2_0_0/lib/PmwNoteBook.py", line 60, in __init__
Pmw.Color.bordercolors(self, self['hull_background'])
File "/sw/lib/python3.5/site-packages/Pmw/Pmw_2_0_0/lib/PmwColor.py", line 359, in bordercolors
'#%04x%04x%04x' % (lightRGB[0], lightRGB[1], lightRGB[2]),
TypeError: %x format: an integer is required, not float
The failure under python 3.5.0 looks like that described in...
https://bugs.python.org/issue23466
but it isn't fixed in python 3.5.1 so perhaps it is yet another corner case?
The failure under python 3.5.0 is suppressed by applying....
to Pmw-2.0.0.
The failure under python 3.4.3 is suppressed by running the psize.py from apbs through 2to3-3.4 and using that recommended change...
I think this could be fixed by replacing all lines similar to
with
This is the approach taken to fix a similar error in yumex-dnf (issue, diff).
Last edit: Alexey Strokach 2016-10-11
as I understand, all requested changes are not in PyMOL, but in third party dependencies.
Probably a hack more than a patch, but I fixed it by casting to int():