|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Invalid token?
Hi, I wrote this in python and do not understand the error message:
Here is my code: "cmd.load(\'/home/lockhartag/Wim/onlyXray_geoff/$filenamein\')\n"; "f=open(\'/home/lockhartag/Wim/HIS/dih2/$filenameout\',\'w\')\n"; "a=cmd.get_dihedral(\'$chain/$resn/ca\',\'$chain/$resn/cb\',\'$chain/$resn/cg\',\'$chain/$resn/cd1\')\n"; "f.write(\" $chain $resn %8.3f\\n\"\\%a)\n"; "f.close()\n"; "cmd.delete('$filenamein')\n"; and the error is: PyMOL>a=cmd.get_dihedral('A/138/ca','A/138/cb','A/138/cg','A/138/cd1') GetDihedral-Error: Selection 4 doesn't contain a single atom/vertex. PyMOL>f.write(" A 138 %8.3f\n"\%a) Traceback (most recent call last): File "/usr/local/bin/pymol/modules/pymol/parser.py", line 455, in parse exec(layer.com2+"\n",self.pymol_names,self.pymol_names) File "<string>", line 1 f.write(" A 138 %8.3f\n"\%a) ^ SyntaxError: invalid token I think the error relates to the bolded line. Any suggestions? |
|
#2
|
|||
|
|||
|
Code:
"f.write(\" $chain $resn %8.3f\\n\"\\%a)\n";
...
f.write(" A 138 %8.3f\n"\%a)
My guess is the complaint is about the %a ending up outside the string, or that it can't work out the resulting \% as a meaningful token. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Invalid token? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|