equinor / segyio

Fast Python library for SEGY files.
Other
489 stars 215 forks source link

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats #557

Open sweettyler opened 1 year ago

sweettyler commented 1 year ago

The error message comes from

File "/home/xxxx/mambaforge/lib/python3.10/site-packages/segyio/trace.py", line 290, in setitem self.filehandle.puttr(self.wrapindex(i), xs) SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

The following is further explained in https://docs.python.org/3/c-api/arg.html#strings-and-buffers " Note For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python 3.9 and older, the type of the length argument is Py_ssize_t if the PY_SSIZE_T_CLEAN macro is defined, or int otherwise. "

learnml2020 commented 1 year ago

I ran into the same problem when I tried to copy a.sgy to b.sgy use the line "dst.trace=src.trace" the python version is 3.12.0 the segyio version 1.9.3

ajmalkoti commented 10 months ago

I ran into a similar problem with segyio ver. 1.9.3. Reinstalling the segyio with the latest version (1.9.12) resolved the issue.