astropy: SystemError: returned NULL without setting an error
I’m getting this error when trying to write a file out using:
ascii.write(data, 'name.dat', format='csv', overwrite=True)
It appears to be related to this cython
closed issue. Removing format='csv'
makes the issue go away.
Here’s what’s in my conda
environment:
$ conda list
# packages in environment at /home/gabriel/anaconda3/envs/asteca3:
#
# Name Version Build Channel
astropy 3.0.4 py37h14c3975_0
atomicwrites 1.1.5 py37_0
attrs 18.1.0 py37_0
autograd 1.2 <pip>
blas 1.0 mkl
ca-certificates 2018.03.07 0
certifi 2018.8.13 py37_0
cycler 0.10.0 py37_0
dbus 1.13.2 h714fa37_1
emcee 2.2.1 pyh24bf2e0_4 astropy
expat 2.2.5 he0dffb1_0
fontconfig 2.13.0 h9420a91_0
freetype 2.9.1 h8a8886c_0
future 0.16.0 <pip>
glib 2.56.1 h000015b_0
gst-plugins-base 1.14.0 hbbd80ab_1
gstreamer 1.14.0 hb453b48_1
icu 58.2 h9c2bf20_1
intel-openmp 2018.0.3 0
jpeg 9b h024ee3a_2
kiwisolver 1.0.1 py37hf484d3e_0
libedit 3.1.20170329 h6b74fdf_2
libffi 3.2.1 hd88cf55_4
libgcc-ng 7.2.0 hdf63c60_3
libgfortran-ng 7.2.0 hdf63c60_3
libpng 1.6.34 hb9fc6fc_0
libstdcxx-ng 7.2.0 hdf63c60_3
libuuid 1.0.3 h1bed415_2
libxcb 1.13 h1bed415_1
libxml2 2.9.8 h26e45fe_1
matplotlib 2.2.2 py37hb69df0a_2
mkl 2018.0.3 1
mkl_fft 1.0.4 py37h4414c95_1
mkl_random 1.0.1 py37h4414c95_1
more-itertools 4.2.0 py37_0
ncurses 6.1 hf484d3e_0
numpy 1.15.0 py37h1b885b7_0
numpy-base 1.15.0 py37h3dfced4_0
openssl 1.0.2p h14c3975_0
pandas 0.23.3 py37h04863e7_0
patsy 0.5.0 py37_0
pcre 8.42 h439df22_0
pip 10.0.1 py37_0
pip 18.0 <pip>
pluggy 0.6.0 py37_0
psutil 5.4.6 py37h14c3975_0
py 1.5.4 py37_0
pyparsing 2.2.0 py37_1
pyqt 5.9.2 py37h22d08a2_0
pytest 3.6.3 py37_0
pytest-arraydiff 0.2 py37h39e3cac_0
pytest-astropy 0.4.0 py37_0
pytest-doctestplus 0.1.3 py37_0
pytest-openfiles 0.3.0 py37_0
pytest-remotedata 0.3.0 py37_0
python 3.7.0 hc3d631a_0
python-dateutil 2.7.3 py37_0
pytz 2018.5 py37_0
qt 5.9.6 h52aff34_0
readline 7.0 ha6073c6_4
sampyl-mcmc 0.3 <pip>
scipy 1.1.0 py37hc49cb51_0
seaborn 0.9.0 py37_0
setuptools 39.2.0 py37_0
sip 4.19.8 py37hf484d3e_0
six 1.11.0 py37_1
sqlite 3.24.0 h84994c4_0
statsmodels 0.9.0 py37h035aef0_0
tk 8.6.7 hc745277_3
tornado 5.0.2 py37h14c3975_0
wheel 0.31.1 py37_0
xz 5.2.4 h14c3975_4
zlib 1.2.11 ha838bed_2
Trace:
Traceback (most recent call last):
...
File "/home/gabriel/anaconda3/envs/asteca3/lib/python3.7/site-packages/astropy/io/ascii/ui.py", line 881, in write
writer.write(table, output)
File "/home/gabriel/anaconda3/envs/asteca3/lib/python3.7/site-packages/astropy/io/ascii/fastbasic.py", line 194, in write
self._write(table, output, {'fill_values': [(core.masked, '')]})
File "/home/gabriel/anaconda3/envs/asteca3/lib/python3.7/site-packages/astropy/io/ascii/fastbasic.py", line 170, in _write
writer = cparser.FastWriter(table, **write_kwargs)
SystemError: <class 'astropy.io.ascii.cparser.FastWriter'> returned NULL without setting an error
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (14 by maintainers)
I’m sorry @bsipocz for some reason I never got a notification of your comment. Disabling
fast_writer=False
makes the issue go away.I can reproduce this bug with Python 3.7 and Astropy 3.0.4 .
Minimal test case to reproduce:
Note how the error is only triggered on the second write call.
I also tried with Astropy master (e9dee2e9589adfe4f0c803246add11164da03b83) and the issue seems to be resolved; so possibly just making a new Astropy release would resolve it.
But maybe it’s worth adding a regression test for this?
Note that if you try to run Astropy tests with Python 3.7 you might run into this pytest bug at the moment: https://github.com/pytest-dev/pytest/issues/3854#issuecomment-415671196
@taldcroft or anyone - thoughts?
Thanks for checking!
It does not.