Giter Club home page Giter Club logo

Comments (9)

ichristen avatar ichristen commented on September 23, 2024

Hi @YuanLi-sz, I added a patch for python versions < 3.8 on a separate branch add_dll (commit 64038e7). If you could test this to make sure that it works on your system (git checkout add_dll), then we will pull this change into main. Hope this helps, and let us know if you run into any further issues! We're still in the pre-release stage, but will do a PiPy release once we've finished polishing, documentation, examples, etc.

from slmsuite.

YuanLi-sz avatar YuanLi-sz commented on September 23, 2024

Hi @ichristen, thank you for the patch!
I am using an Applied Vision camera and Vimbapython so I didn't test the thorlabs.py, but the _slm_win.py patch is not working. The _slm_win.py is still reporting an error as following:

PS C:\Users\SLM\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages> & C:/Users/SLM/AppData/Local/Microsoft/WindowsApps/python3.7.exe c:/Users/SLM/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0/LocalCache/local-packages/Python37/site-packages/slmsuite/hardware/slms/_slm_win.py
Traceback (most recent call last):
File "c:/Users/SLM/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0/LocalCache/local-packages/Python37/site-packages/slmsuite/hardware/slms/_slm_win.py", line 38, in
_libraries[_libname] = windll.LoadLibrary(libname)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes_init
.py", line 442, in LoadLibrary
return self.dlltype(name)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes_init
.py", line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

I am very certain that both the dll files are in the same directory:

PS C:\Users\SLM\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\slmsuite\hardware\slms> ls

Directory: C:\Users\SLM\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ 
slmsuite\hardware\slms

Mode LastWriteTime Length Name


d----- 10/26/2022 6:42 PM pycache
-a---- 3/16/2018 9:18 AM 207360 FTD3XX.dll
-a---- 10/28/2022 2:31 PM 101 PyCheck.py
-a---- 11/3/2022 5:55 PM 9680 santec.py
-a---- 10/14/2022 1:57 PM 15250 screenmirrored.py
-a---- 10/14/2022 1:57 PM 15518 slm.py
-a---- 7/13/2021 11:12 AM 375808 SLMFunc.dll
-a---- 11/3/2022 5:49 PM 14095 _slm_win.py
-a---- 10/25/2022 6:43 PM 89 init.py

I also tried directly adding the file to the library and doing a os.chdir() but both didn't work out.

from slmsuite.

ichristen avatar ichristen commented on September 23, 2024

Hi @YuanLi-sz ,

That error suggests that there might be some issue with .dll dependencies. That is to say, Santec's .dll is linked to other .dlls, but it's having trouble finding these other .dlls. I would suggest two parallel approaches to resolve this:

  • Did you install Santec's GUI? It comes on a USB disk with the SLM. I think the installer will cover all the dependencies. You should also use this vendor GUI to make sure the SLM is working.
  • I have had luck with using Dependency Walker to trace .dll linkages and find what's causing such opaque errors. Dependency Walker will show you what dependencies are successfully found, and what dependencies are not found.

Hope this helps!

Also, @tpr0p , I didn't internalize how awkward putting the .dlls into pip install directories would be (we generally work off of the repo directly). Maybe we should revisit where .dlls should go (maybe in the same directory as the root script?).

from slmsuite.

YuanLi-sz avatar YuanLi-sz commented on September 23, 2024

Hi @ichristen ,
Thank you so much for all the help!
I tried with the Dependency Walker and It's indeed linked with several .dlls in the system32 folder, and under these .dlls in system32 there are so many missing .dlls like hundreds. I am not very sure what's causing this. I updated the system and run the sfc/scannow but didn't fix anything. I might just erase the computer and reinstall everything with a higher version of python.

from slmsuite.

ichristen avatar ichristen commented on September 23, 2024

Hi @YuanLi-sz , sorry for my late reply. Were you able to get Santec's GUI to work? I would suggest this as a first step.

from slmsuite.

YuanLi-sz avatar YuanLi-sz commented on September 23, 2024

@ichristen Sorry i for got to mention that. Yes the GUI is working good, and I have another program program based on wxpython also works.

from slmsuite.

ichristen avatar ichristen commented on September 23, 2024

@YuanLi-sz
This is an interesting problem. You might consider the following course of action:

  • I wouldn't erase the computer just yet. Consider instead installing a new python environment via anaconda. Then use pip to install slmsuite on the environment. I'm not precisely sure how .dll dependencies are looked up, but this might help with that.
  • Consider trying a different computer. This will help to isolate the problem. We have not encountered this issue after testing on order ten different computers (running Windows 7, 10, 11). It will be interesting if the problem occurs again. Maybe a faulty .dll?
  • If the above doesn't work, I would E-mail Santec to see if they have any ideas. At this point, it seems like the .dll is failing, so I don't know what else to do python-side.
  • If you're interested in using features inside slmsuite, you can use the ScreenMirrored interface instead of Santec. ScreenMirrored does not currently support >8bit operation or allow the user to set the Santec wavelength lookup table, however.

from slmsuite.

YuanLi-sz avatar YuanLi-sz commented on September 23, 2024

HI @ichristen,
Thank you so much for all these suggestion!
Actually i have already started the the resetting in 30 minutes ago. I have considered about using the anaconda earlier but there're five versions of Pythons in this laptop and this is the only available computer for SLM control so I would rather just reset everything since I would need to do this sooner or laster. FYI i am replying to you on my macbook.
Thanks again for all the help!

from slmsuite.

ichristen avatar ichristen commented on September 23, 2024

Closing this issue due to #13, which should eliminate the original python<3.7 issue. @YuanLi-sz , let us know if you got things working, or if you'd like to discuss more!

from slmsuite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.