{"action":"created","issue":{"url":"https://api.github.com/repos/esheldon/fitsio/issues/92","repository_url":"https://api.github.com/repos/esheldon/fitsio","labels_url":"https://api.github.com/repos/esheldon/fitsio/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/esheldon/fitsio/issues/92/comments","events_url":"https://api.github.com/repos/esheldon/fitsio/issues/92/events","html_url":"https://github.com/esheldon/fitsio/issues/92","id":168645596,"number":92,"title":"Variable-length columns in python3.5","user":{"login":"bwinkel","id":6582333,"avatar_url":"https://avatars.githubusercontent.com/u/6582333?v=3","gravatar_id":"","url":"https://api.github.com/users/bwinkel","html_url":"https://github.com/bwinkel","followers_url":"https://api.github.com/users/bwinkel/followers","following_url":"https://api.github.com/users/bwinkel/following{/other_user}","gists_url":"https://api.github.com/users/bwinkel/gists{/gist_id}","starred_url":"https://api.github.com/users/bwinkel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwinkel/subscriptions","organizations_url":"https://api.github.com/users/bwinkel/orgs","repos_url":"https://api.github.com/users/bwinkel/repos","events_url":"https://api.github.com/users/bwinkel/events{/privacy}","received_events_url":"https://api.github.com/users/bwinkel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":42,"created_at":"2016-08-01T13:27:55Z","updated_at":"2016-08-11T12:22:51Z","closed_at":null,"body":"I try to read a table with variable-length columns. With python2.7 this always worked for me, but I now tried python3.5 and get an error:\r\n\r\n```python\r\nimport fitsio\r\n\r\nhdu = fitsio.FITS('MONITOR.fits')[1]\r\nhdu[:]\r\n```\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-1-7853e0d84ff3> in <module>()\r\n      3 hdu = fitsio.FITS('MONITOR.fits')[1]\r\n      4\r\n----> 5 hdu[:]\r\n...\r\n/home/bwinkel/local/anaconda3/lib/python3.5/site-packages/fitsio/fitslib.py in _read_rec_with_var(self, colnums, rows, dtype, offsets, isvar, vstorage)\r\n   2303\r\n   2304                             if sys.version_info > (3,0,0):\r\n-> 2305                                 array[name][irow] = item\r\n   2306                             else:\r\n   2307                                 array[name][irow][0:ncopy] = item[:]\r\n\r\nValueError: could not broadcast input array from shape (2) into shape (3)\r\n```\r\n\r\nIf I change the relevant line (2305) to\r\n```python\r\ntry:\r\n    array[name][irow] = item\r\nexcept ValueError:\r\n    array[name][irow][0:ncopy] = item[:]\r\n```\r\nit seems to work again.\r\n\r\nNote, it is not sufficient to just always do\r\n```python\r\narray[name][irow][0:ncopy] = item[:]\r\n```\r\nbecause string columns may then cause an issue:\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n...\r\n/home/bwinkel/local/anaconda3/lib/python3.5/site-packages/fitsio/fitslib.py in _read_rec_with_var(self, colnums, rows, dtype, offsets, isvar, vstorage)\r\n   2303 \r\n   2304                             if sys.version_info > (3,0,0):\r\n-> 2305                                 array[name][irow][0:ncopy] = item[:]\r\n   2306                             else:\r\n   2307                                 array[name][irow][0:ncopy] = item[:]\r\n\r\nTypeError: 'numpy.bytes_' object does not support item assignment\r\n```\r\n\r\nYou can download the FITS file, I used for testing, from here:\r\nhttps://astro.uni-bonn.de/~bwinkel/MONITOR.fits\r\n\r\nThanks a lot for your work! "},"comment":{"url":"https://api.github.com/repos/esheldon/fitsio/issues/comments/239145643","html_url":"https://github.com/esheldon/fitsio/issues/92#issuecomment-239145643","issue_url":"https://api.github.com/repos/esheldon/fitsio/issues/92","id":239145643,"user":{"login":"esheldon","id":621661,"avatar_url":"https://avatars.githubusercontent.com/u/621661?v=3","gravatar_id":"","url":"https://api.github.com/users/esheldon","html_url":"https://github.com/esheldon","followers_url":"https://api.github.com/users/esheldon/followers","following_url":"https://api.github.com/users/esheldon/following{/other_user}","gists_url":"https://api.github.com/users/esheldon/gists{/gist_id}","starred_url":"https://api.github.com/users/esheldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esheldon/subscriptions","organizations_url":"https://api.github.com/users/esheldon/orgs","repos_url":"https://api.github.com/users/esheldon/repos","events_url":"https://api.github.com/users/esheldon/events{/privacy}","received_events_url":"https://api.github.com/users/esheldon/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T12:22:50Z","updated_at":"2016-08-11T12:22:50Z","body":"Ok to close?"}}
{"actor":{"display_login":"esheldon"}}