Subject: Re: [nmr_sparky] About the extension "ax--Atom name translation"
From: Eiso AB
Date: Dec 6, 2005

Previous: 39 Next: 41


ethernet3399 wrote:
Recently I try the extension Atom name translation, but I got the
following error message from Python shell:

File /usr/local/NMR_software/sparky-ShiGH/python/sparky/atoms.py, line
169, in is_standard_name
return atomnames.standard_group_atom_table.has_key(group_symbol,
atom_name)
TypeError: has_key() takes exactly 1 argument (2 given)

As if this extension concerns these two files: atomnames.py and
atoms.py.

In the atoms.py file, line 168-169:

168 def is_standard_name(group_symbol, atom_name):
169 return atomnames.standard_group_atom_table.has_key(group_symbol,
atom_name)
on my system it is this,

def is_standard_name(group_symbol, atom_name):
return atomnames.standard_group_atom_table.has_key((group_symbol, atom_name))

two pairs of parentheses: (( ))

I dont remember if I made this change myself, so use at your own risk

Eiso


While in file atomnames.py, have these lines with line number 422-436:

422 def group_atom_table(group_to_atom_list):
423
424 t = {}
425 for g in group_to_atom_list.keys():
426 for a in group_to_atom_list[g]:
427 t[(g,a)] = 1
428 return t
429
430 #
-----------------------------------------------------------------------------
431 # Setup standard tables that include proteins, dna, and rna names
432 #
433 standard_atoms_by_group = {}
434 merge_table(protein_atoms_by_group, standard_atoms_by_group)
435 merge_table(dna_rna_atoms_by_group, standard_atoms_by_group)
436 standard_group_atom_table = group_atom_table(standard_atoms_by_group)

I dont find the class standard_group_atom_table has this attribute
has_key, or this attribute is definited in other modules?
And how to solve the problem list above? Who can help?

has_key() is a standard method of a dict ,
as the name says, it checks if a key is present.

Eiso





--
_________
_________________/ Eiso AB ___________________________