best bet for using a .NET dll

Virgil Dupras hardcoded.software at gmail.com
Tue Nov 21 07:21:43 EST 2006


Warren Jackson wrote:
> I'd like to make a simple program that uses the Canon digital camera
> SDK (EDSDK 1.3).  Basically I need to take pictures and download them
> to my computer.  They have a fair amount of example code for the .NET
> languages, and don't officially support anything else.
>
> The API uses more than the basic c types (references, etc.) that I'm
> not totally familiar with yet.  Included at the bottom is an example
> of one of the functions.
>
> What is my best bet for writing this in Python? cTypes, IronPython,
> something else?  I haven't worked with either before but am currently
> reading up.  It seams cTypes has a difficult time dealing with
> anything but the 'normal' c types, is this correct?
>
> Would it be easier to just write a program in C# to handle all of the
> fancy types? (ie. make a function that opens and closes session, finds
> camera, takes picture, downloads picture, saves picture - that can
> then be read in python) ?  This isn't a very attractive option to me.
>
> Thanks in advance for any insight.
>
>
>
>
>
>
> 3.1.24 EdsDownload
>
> Description:
> Downloads a file on a remote camera (in the camera memory or on a
> memory card) to the host computer. The downloaded file is sent
> directly to a file stream created in advance.
> When dividing the file being retrieved, call this API repeatedly. Also
> in this case, make the data block size a multiple of 512 (bytes),
> excluding the final block.
>
> Syntax
> EdsError EDSAPI EdsDownload( EdsDirectoryItemRef inDirItemRef,
> EdsUInt32 inReadSize,
> EdsStreamRef outStreamRef )
>
> Parameters
> inDirItemRef
> Designate the file object in the camera to download.
> inReadSize
> Designate the size in bytes to download.
> outStreamRef
> Specifies the destination stream. The stream for downloading is
> created by means of EdsCreateFileStream, EdsCreateMemoryStream, or the
> like.
>
> Return Values
> Returns EDS_ERR_OK if successful. In other cases, see the EDS Error Lists.

There is also "Python for .Net", which is simply a bridge (as opposed
to IronPython, which is a complete python implementation). It works
pretty well.




More information about the Python-list mailing list