jorisvandenbossche opened a new issue, #423:
URL: https://github.com/apache/arrow-nanoarrow/issues/423

   Running
   
   ```python
   import nanoarrow as na
   na.Array([0, 1, 2, None])
   ```
   
   gives
   
   ```
   ValueError                                Traceback (most recent call last)
   File 
[~/scipy/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py:363](http://localhost:8888/lab/tree/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py#line=362),
 in c_array_stream(obj, schema)
       362 try:
   --> 363     array = c_array(obj, schema=schema)
       364     return CArrayStream.from_array_list([array], array.schema, 
validate=False)
   
   File 
[~/scipy/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py:179](http://localhost:8888/lab/tree/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py#line=178),
 in c_array(obj, schema)
       178 if _obj_is_iterable(obj):
   --> 179     return _c_array_from_iterable(obj, schema)
       181 raise TypeError(
       182     f"Can't convert object of type {type(obj).__name__} to 
nanoarrow.c_array"
       183 )
   
   File 
[~/scipy/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py:607](http://localhost:8888/lab/tree/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py#line=606),
 in _c_array_from_iterable(obj, schema)
       606 if schema is None:
   --> 607     raise ValueError("schema is required for CArray import from 
iterable")
       609 obj_len = -1
   
   ValueError: schema is required for CArray import from iterable
   
   The above exception was the direct cause of the following exception:
   
   TypeError                                 Traceback (most recent call last)
   Cell In[2], line 1
   ----> 1 na.Array([0, 1, 2, None])
   
   File 
[~/scipy/repos/arrow-nanoarrow/python/src/nanoarrow/array.py:153](http://localhost:8888/lab/tree/repos/arrow-nanoarrow/python/src/nanoarrow/array.py#line=152),
 in Array.__init__(self, obj, schema, device)
       150     self._data = CMaterializedArrayStream.from_c_array(obj)
       151     return
   --> 153 with c_array_stream(obj, schema=schema) as stream:
       154     self._data = CMaterializedArrayStream.from_c_array_stream(stream)
   
   File 
[~/scipy/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py:366](http://localhost:8888/lab/tree/repos/arrow-nanoarrow/python/src/nanoarrow/c_lib.py#line=365),
 in c_array_stream(obj, schema)
       364     return CArrayStream.from_array_list([array], array.schema, 
validate=False)
       365 except Exception as e:
   --> 366     raise TypeError(
       367         f"Can't convert object of type {type(obj).__name__} "
       368         "to nanoarrow.c_array_stream or nanoarrow.c_array"
       369     ) from e
   
   TypeError: Can't convert object of type list to nanoarrow.c_array_stream or 
nanoarrow.c_array
   ```
   
   The message at the end (what you typically look at) is not super clear why 
this would not be possible to convert a list (it _is_ possible), while the 
error in the middle actually has the correct message ("schema is required for 
CArray import from iterable")


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to