Skip to content

fail to measure power with TLPMX_dll using Python #41

@Kubiczek36

Description

@Kubiczek36

Running your example Python/Thorlabs PMxxx Power Meters/TLPMX_dll/PMxxx using ctypes - Python 3.py I am getting a following error:

(imswitch_311) C:\software\jd_calculations> c: && cd c:\software\jd_calculations && cmd /C "c:\Users\blmicroscope\AppData\Local\anaconda3\envs\imswitch_311\python.exe c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher 51640 -- C:\software\jd_calculations\2025-11-04-SLM_calibration\powermeter.py "
Number of found devices: 1

Resource name of device 0 : b'USB0::0x1313::0x807B::::INSTR'

Traceback (most recent call last):
  File "c:\Users\blmicroscope\AppData\Local\anaconda3\envs\imswitch_311\Lib\runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\blmicroscope\AppData\Local\anaconda3\envs\imswitch_311\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\__main__.py", line 71, in <module>
    cli.main()
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 508, in main
    run()
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 358, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 310, in run_path
    return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 127, in _run_module_code    
    _run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
  File "c:\Users\blmicroscope\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "C:\software\jd_calculations\2025-11-04-SLM_calibration\powermeter.py", line 36, in <module>
    tlPM.open(resourceName, c_bool(True), c_bool(True))
  File "C:\software\jd_calculations\2025-11-04-SLM_calibration\TLPMX.py", line 395, in open
    self.__testForError(pInvokeResult)
  File "C:\software\jd_calculations\2025-11-04-SLM_calibration\TLPMX.py", line 354, in __testForError
    self.__throwError(status)
  File "C:\software\jd_calculations\2025-11-04-SLM_calibration\TLPMX.py", line 360, in __throwError
    raise NameError(c_char_p(msg.raw).value)
NameError: b'Insufficient location information or the device or resource is not present in the system.'

Used wih PM16-120 SN:201105221.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions