Hi,
some more issues (with solutions...) on the foreign=python front here.
1) In gretltmp.py, "execfile": I just found out that this was scrapped
in Python 3. There is an official replacement (in Python's 2to3
conversion tool), but here I think it's simpler to just replace it with:
<python>
from gretl_io import gretl_dotdir, gretl_loadmat, gretl_export
</python>
This should work on all Python versions, but it assumes that gretl_io.py
will always be in the same directory as gretltmp.py, but AFAIU that's
the case by construction, no?
2) In gretl_io.py, first I think the gretl_export() function is a little
broken: The target file is opened in text mode but apparently savetxt
writes bytes, which it cannot do on text-mode opened files. So the
export doesn't take place. (Or did it for you?) A solution would be to
tell savetxt to also write the header, and all the other lines would be
unnecessary:
<python>
# f = open(fname, 'wb')
# f.write(repr(r) + '\t' + repr(c) + '\n')
savetxt(fname, M, fmt='%.18e', delimiter=' ',
header=repr(r)+'\t'+repr(c), comments='')
# f.close()
# return
</python>
The drawback is that this is a new feature in Numpy 1.7 which was just
released last month. OTOH it's a new gretl feature as well, so maybe
it's ok to have demanding version requirements.
Secondly, a follow-up on asmatrix(X): It seems that a 1-dim vector is
interpreted as a row vector and as such is written out to the file in a
single row/line (but with the header correct). Is that a problem (for
gretl)?
3) Could it be that gretl_io.py doesn't get re-created if gretl thinks
it created it already? (But it may have been deleted in the meantime.)
Thanks,
sven