On 01/13/2018 11:05 AM, Andrea Spinelli wrote:
I try to use python3, but it doesn't working.
I can't understand why if I use my modeller module file in python
command prompt, it works. If I use the function in a script, not.
You have an elementary Python error in your script - not a Modeller
problem. Your pir_export function never closes its file handle, so the
alignment file is empty until the handle is flushed (at the end of the
script, too late for Modeller). Simple solution would be to replace
"pir_file.close" with "pir_file.close()". A better solution would be
to use 'with' to open your file, as per
https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/
Ben Webb, Modeller Caretaker