import pyfits で py-file で py2exe を実行すると、エラーが発生しました。
このエラーを回避するにはどうすればよいですか?
以下に示すtest.pyとtest_setup.py(py2exe用)を用意します。
test.py は引数で指定されたfitsfileのデータを表示するシンプルなプログラムです。
- OS:Windows7 64ビット
- パイソン: 2.7
- ピフィット:3.3
- でこぼこ: 1.9.2
cmd.exe:
\python test_setup.py py2exe
=>成功
\python test.py test.fits
[[[574 574 579 ..., 579 585 581]
[574 582 583 ..., 582 579 577]
[581 583 578 ..., 572 580 580]
...,
[584 585 580 ..., 584 582 579]
[585 583 582 ..., 586 575 578]
[584 580 583 ..., 585 585 589]]]
=>成功
\dist\test.exe test.fits
Traceback (most recent call last):
File "test.py", line 4, in <module>
import pyfits
File "pyfits\__init__.pyo", line 11, in <module>
File "pyfits\core.pyo", line 42, in <module>
File "pyfits\convenience.pyo", line 62, in <module>
File "pyfits\hdu\__init__.pyo", line 2, in <module>
File "pyfits\hdu\compressed.pyo", line 21, in <module>
File "pyfits\hdu\table.pyo", line 646, in <module>
File "pyfits\hdu\table.pyo", line 909, in BinTableHDU
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
=> エラー
test.py
# -*- coding: utf-8 -*-
import sys
import pyfits
def showfits(path):
hdulist = pyfits.open(path)
imgs = hdulist[0].data
hdulist.close()
print imgs
if __name__ == "__main__":
showfits(sys.argv[1])
test_setup.py
# -*- coding: utf-8 -*-
from distutils.core import setup
import py2exe
option = {
"compressed" : 1 ,
"optimize" : 2 ,
"bundle_files" : 3
}
setup(
options = {
"py2exe" : option
},
console = [
{
"script" : "test.py"
}
],
zipfile = None
)