Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix load library for PS2000A on OSX. #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion picoscope/darwin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def LoadLibraryDarwin(library):

http://ulthiel.com/vk2utl/picoscope-python-interface-under-mac-os-x/
"""
PICO_LIB_PATH = "/Applications/PicoScope6.app/Contents/Resources/lib/"
PICO_LIB_PATH = "/Applications/PicoScope 6.app/Contents/Resources/lib/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please make this more "backward" compatible?? I understand that Picoscope moved the location of their file.

If you could "try both locations" in a loop or something, that would be better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, Picoscope changed the path at least 1.5 years ago, so is there anything to be backwards compatible to? Is it possible to install a Picoscope library that uses the old path?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.5 years is not a long time for instrumentation. often I'll just leave the software at the version I had when I first got the instrument. it's pretty important to me that the old stuff continues to work at least for a few more months.


# Libraries that depend on libiomp5.dylib
IOMP5_DEPS = ["libpicoipp.dylib", "libpicoipp.1.dylib"]
Expand Down
9 changes: 4 additions & 5 deletions picoscope/ps2000a.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def __init__(self, serialNumber=None, connect=True):
from ctypes import cdll
self.lib = cdll.LoadLibrary("lib" + self.LIBNAME + ".so")
elif platform.system() == 'Darwin':
self.lib = self.loadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this ta typo?

from picoscope.darwin_utils import LoadLibraryDarwin
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
Expand Down Expand Up @@ -401,8 +402,7 @@ def _lowLevelGetValuesBulk(self, numSamples, fromSegment, toSegment,
c_int16(toSegment),
c_int32(downSampleRatio),
c_int16(downSampleMode),
overflow.ctypes.data_as(POINTER(c_int16))
)
overflow.ctypes.data_as(POINTER(c_int16)))
self.checkResult(m)
return overflow, numSamples

Expand All @@ -415,8 +415,7 @@ def _lowLevelGetTriggerTimeOffset(self, segmentIndex):
byref(timeUpper),
byref(timeLower),
byref(timeUnits),
c_uint32(segmentIndex),
)
c_uint32(segmentIndex))
self.checkResult(m)

# timeUpper and timeLower are the upper 4 and lower 4 bytes of a 64-bit
Expand Down