comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL to Python bridge and "file-like" Python object
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL to Python bridge and "file-like" Python object [message #93249 is a reply to message #93245] Thu, 19 May 2016 11:22 Go to previous messageGo to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Thursday, May 19, 2016 at 5:39:55 AM UTC-6, alx wrote:
> Le jeudi 19 mai 2016 11:53:19 UTC+2, Fabien a écrit :
>> On 05/18/2016 06:22 PM, alx wrote:
>>> Of course, as you said, it is possible to cast the bytes variable inside Python, then to transfer it to IDL. But it is a bit laborious (and slow ?).
>>
>> Does your package support python3? It seems that the bytarray problems
>> has something to do with str representations in legacy python.
>>
>> Cheers,
>>
>> Fabien
>
> I am using FDB 1.6, Python 3.4 (both quoted as compatible) and IDL 8.5.1.
> From my previous post you can check that the FDB blobReader output is a binary bytearray (bytes) within Python, but a string within IDL.
> Therefore, the issue looks like to not come from Python but from the IDL/Python bridge, which (incorrectly, I guess) converts Python bytes variable into IDL string (as you can see in the Exelis Python bridge documentation).
> This choice is unfortunate because Python bytes variable (afaik, but I am not familiar enough with Python) can contain zero values.
> alain.

I assume the actual numeric values stored in the blob are not bytes, but are integers, floats, etc.

In this case, you might need to use a utility like Python's struct to reconstitute your data appropriately. Even if you were to get the data into IDL as a BYTARR() you would still need to perform a conversion to INTEGER, FLOAT, etc., AND concern yourself with endianness.

You may be better off by simply letting the existing Python tools do that work for you first.

This reference may be of use, or there may be better solutions:

https://docs.python.org/2/library/struct.html

Jim P.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: issues appending roi from IDLanROI to IDLanROIGroup
Next Topic: Read ASCII line till semicolon

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Nov 28 09:27:18 PST 2025

Total time taken to generate the page: 0.00884 seconds