Hi Matt,

Well, then you're in for some nasty debugging. That will probably end
with you slapping yourself against the head, as I've done plenty ofc
times on such occasions. I tried the same things using the same sort
of code you posted, and it worked for me. Of course, I'd rather do
something like:

L = [ i.strip() for i in open("files.nam").readlines() if i.strip() ]
for i in L: cmd.load( i, i )

But those are details really.
You may want to print the list of filenames right after reading them
in, and again after changing the entries. That may give a clue of what
goes wrong.

Cheers,

Tsjerk

On Tue, Nov 10, 2009 at 6:05 PM, Mateusz Maciejewski
<s0676...@sms.ed.ac.uk> wrote:
> Dear Tsjerk,
>
> I actually also tried using full paths in the script, as in
>
>
> for n in range(len(linie)): linie[n] = ["/path/to/my/files/" +
> linie[n][:-1]]
>
>
> Then in the PyMOL interpreter/ log window I was getting
>
>
> ExecutiveProcessPDBFile-Error: Unable to open file
> '/path/to/my/files/compstatin.pdb_14'.
>
>
> in the traceback. Yes, the file is in the same directory as the pdb file and
> the script. Again if in the script I put names of files I want to open in
> the 'linie' list manually rather then make it read in from a file, then it
> works fine. Puzzling.
>
>
> Thanks,
> Matt
>
>
>
> On Tue, Nov 10, 2009 at 4:51 PM, Tsjerk Wassenaar <tsje...@gmail.com> wrote:
>>
>> Hi Mateusz,
>>
>> The first guess would be that you're not in the right directory, since
>> Pymol can't find the file. That seems a bit awkward, as I guess
>> they're in the same directory as "converged.nam", or aren't they? To
>> see what is in the directory, you can call cmd.ls() at the start of
>> the script. For what it's worth, the script is syntactically correct,
>> although it could be written a bit more neatly ;)
>>
>> Hope it helps,
>>
>> Tsjerk
>>
>> On Tue, Nov 10, 2009 at 5:08 PM, Mateusz Maciejewski
>> <s0676...@sms.ed.ac.uk> wrote:
>> > Hello,
>> >
>> > I'm writing a script in Python to be executed in PyMOL. Unfortunately I
>> > got
>> > stuck right at the beginning, when I'm trying to load .pdb's from
>> > "converged.nam" file. The relevant bit of the script is the following:
>> >
>> >
>> > from pymol.cgo import *
>> > from pymol import cmd
>> >
>> > loadedStuff=open("converged.nam", 'r')
>> > linie = loadedStuff.readlines()
>> > for n in range(len(linie)): linie[n] = linie[n][:-1]
>> > for n in range(len(linie)): print n, linie[n]
>> > for n in linie: cmd.load(n,n)
>> >
>> >
>> >
>> > Unfortunately, it is not working - I keep on getting:
>> >
>> >
>> >
>> > 0 compstatin.pdb_14
>> > 1 compstatin.pdb_72
>> > 2 compstatin.pdb_91
>> > 3 compstatin.pdb_93
>> > 4 compstatin.pdb_78
>> > 5 compstatin.pdb_34
>> > 6 compstatin.pdb_32
>> > 7 compstatin.pdb_7
>> > 8 compstatin.pdb_47
>> > 9 compstatin.pdb_31
>> > 10 compstatin.pdb_5
>> > ExecutiveProcessPDBFile-Error: Unable to open file 'compstatin.pdb_14'.
>> > Traceback (most recent call last):
>> >   File "/usr/local/pymol/modules/pymol/parsing.py", line 407, in
>> > run_file
>> >     execfile(file,global_ns,local_ns)
>> >   File "align.py", line 8, in ?
>> >     for n in linie: cmd.load(n,n)
>> >   File "/usr/local/pymol/modules/pymol/importing.py", line 575, in load
>> >     if _raising(r): raise pymol.CmdException
>> > CmdException: <pymol.CmdException instance at 0x56fdc6cc>
>> >
>> >
>> >
>> > When I manually form a list containing all the compstatin entries than
>> > it is
>> > working, so it must be something with how it processes the list which it
>> > gets from the file. I can't really understand why that is so, especially
>> > given how it correctly pronts out the content of the list that captures
>> > the
>> > content of the file. I am obviously making some silly mistake here...
>> > any
>> > suggestions?
>> >
>> > Thank you,
>> > Mateusz Maciejewski
>> >
>> > ----------------------------------------------
>> >
>> >
>> >
>> > Mateusz Maciejewski,
>> > University of Edinburgh
>> > Joseph Black Chemistry Bldg, West Mains Rd.,
>> > Edinburgh EH9 3JJ, U.K.
>> > Phone (44) (0) 131 650 4704 (group office)
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> > 30-Day
>> > trial. Simplify your report design, integration and deployment - and
>> > focus
>> > on
>> > what you do best, core application coding. Discover what's new with
>> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> > _______________________________________________
>> > 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
>> >
>>
>>
>>
>> --
>> Tsjerk A. Wassenaar, Ph.D.
>>
>> Computational Chemist
>> Medicinal Chemist
>> Neuropharmacologist
>>
>
>



-- 
Tsjerk A. Wassenaar, Ph.D.

Computational Chemist
Medicinal Chemist
Neuropharmacologist

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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