next up previous contents index
Next: The scripts module: utility Up: The modfile module: handling Previous: modfile.inquire() check   Contents   Index

modfile.File() -- open a handle to a MODELLER file

File(filename, mode='r')
This opens a file and returns a handle object, which can be used for methods that need an open file, such as alignment.read_one(). The file is closed automatically when the handle object is deleted, or explicitly by calling its close method.

The mode argument functions similarly to that used by C or Python; i.e., the following modes are acceptable: 'r', 'w', 'rb' and 'wb', to open a file for reading in text mode, writing in text mode, reading in binary mode, or writing in binary mode, respectively. Note that while only Windows operating systems make a distinction between text and binary mode, MODELLER will do some additional checks on text format files to catch common mistakes (e.g., trying to read a Unicode rather than plain text file) so you should use the 'b' suffix on all platforms if you are using binary files.
Example: See alignment.read_one() command.


next up previous contents index
Next: The scripts module: utility Up: The modfile module: handling Previous: modfile.inquire() check   Contents   Index
Automatic builds 2011-09-28