mabl / PyPylon

An experimental python wrapper around the Basler Pylon 5 library
BSD 3-Clause "New" or "Revised" License
53 stars 34 forks source link

mac osx compatible #15

Closed felixhol closed 8 years ago

felixhol commented 8 years ago

hi - I've been using pypylon on an ubuntu machine for a while and it works pretty well - thanks! For some field experiments I'll be doing in the rainforest it would be great if I could use the same code to control my basler camera from my macbook. Would it be hard to make this project mac osx compatible?

mabl commented 8 years ago

Hi @felixhol ,

I do not have osx, but I imagine that it would more or less work out of the box. The only thing which might be tricky is the path it looks for the library configuration tool. For non-Microsoft targets, this is /opt/pylon5/bin/pylon-config could you check where pylon-config gets installed under osx?

ryanbahneman commented 8 years ago

I'm also looking to use this on OSX. The default location is /Library/Frameworks/pylon.framework/Resources/Tools/pylon-config

ryanbahneman commented 8 years ago

I hacked in this code:

elif sys.platform == 'darwin':
    build_options = detect_pylon('/Library/Frameworks/pylon.framework/Resources/Tools/pylon-config')

but it failed because the subprocess command error out.

Running the command manually gives:

--> /Library/Frameworks/pylon.framework/Resources/Tools/pylon-config --libdir
Unknown command --libdir
Usage: /Library/Frameworks/pylon.framework/Resources/Tools/pylon-config <command>... [library]

Return metainformation about the given library:
    pylon               the pylon C++ library (default)

  Allowed Commands:
    -h, --help          Show this help message
    --version           Prints the full pylon version
    --version-major     Prints the major version
    --version-minor     Prints the minor version
    --version-subminor  Prints the subminor version
    --version-build     Prints the build version

It looks like the pylon-config shipped with OSX doesn't have the same API.

ryanbahneman commented 8 years ago

I've been recently playing with cython so I thought I would give adding OSX support a shot. See: #16

mabl commented 8 years ago

Strange, they don't seam to value consistency... What's the output of a call to pylon-config without any parameters?

ryanbahneman commented 8 years ago

@mabl Perhaps they only fully support linux and other OS's have to fend for themselves?

--> /Library/Frameworks/pylon.framework/Resources/Tools/pylon-config
Usage: /Library/Frameworks/pylon.framework/Resources/Tools/pylon-config <command>... [library]

Return metainformation about the given library:
    pylon               the pylon C++ library (default)

  Allowed Commands:
    -h, --help          Show this help message
    --version           Prints the full pylon version
    --version-major     Prints the major version
    --version-minor     Prints the minor version
    --version-subminor  Prints the subminor version
    --version-build     Prints the build version
felixhol commented 8 years ago

just wanted to let you guys know that I truly appreciate your help on this (though unfortunately I don't seem to be in a position to provide much useful input myself at this point...)

mabl commented 8 years ago

Hi @felixhol, you can try #16, it looks sane enough to get it working on your laptop. Still I'd like to see that it really needs that much hard-coding.

@ryanbahneman that output is really not useful at all... I'll probably have another look at your pull request and merge it as long as I know no saner way to do it.

ryanbahneman commented 8 years ago

@mabl Yeah, it's not super useful. Sorry. I found out that the dylib linking was unnecessary so I updated the pull request #16 to make it a little simpler. I'm not an expert with cython, so there is probably a better way to get it done.

@felixhol I'm also curious to see if it works for you.

Using #16 I'm able call into the Pylon library, but I'm not able to find any cameras. Running the C++ Pylon examples I'm able to find my camera, so I know it's connected correctly. @mabl, did you need to configure anything in python/cython to get discovery to work?

ryanbahneman commented 8 years ago

@mabl I spent a little effort cleaning up the merge request. I initially used a shotgun approach to get it to compile and there was a lot of unnecessary settings. It's much cleaner now.

mabl commented 8 years ago

Yep I see that. LGTM. @felixhol you can use the master branch on OSX now. Let me know if it gives you trouble.

felixhol commented 8 years ago

i can call into the pylon library now yet i seem to have the same problemm as @ryanbahneman - pypylon can't find my camera. Using the viewer app provided with pylon I can preview the camera so it is connected, yet pypylon does see it, any hints on how to fix this...? thanks!

ryanbahneman commented 8 years ago

@felixhol Thanks for trying! I was pulling my hair out on Friday trying to debug this. I created #18 to track the issue.

@mabl Any idea what could be going wrong?