Message204536
| Author |
hct |
| Recipients |
hct |
| Date |
2013年11月26日.20:54:09 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1385499249.85.0.446556603594.issue19803@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I'm trying to create ctypes buffer to be used back and forth with C libraries, but I keep getting errors. I need to slice the buffer to cut out different pieces to work on, so I try to get a memoryview of the buffer. does the error message imply that c_ubyte, c_uint8, c_byte and c_char are not native single character types?
>>> memoryview(c_ubyte()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview((c_ubyte*1024)()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview(c_uint8()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview((c_uint8*1024)()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview((c_byte*1024)()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview((c_char*1024)()).cast('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> memoryview((c_char*1024)())[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format (1024)<c
>>> memoryview((c_byte*1024)())[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format (1024)<b
>>> memoryview((c_ubyte*1024)())[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format (1024)<B
>>> memoryview((c_uint8*1024)())[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format (1024)<B
>>> |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年11月26日 20:54:09 | hct | set | recipients:
+ hct |
| 2013年11月26日 20:54:09 | hct | set | messageid: <1385499249.85.0.446556603594.issue19803@psf.upfronthosting.co.za> |
| 2013年11月26日 20:54:09 | hct | link | issue19803 messages |
| 2013年11月26日 20:54:09 | hct | create |
|