Unable to control the 4200A-SCS remotely via lptlib using Ethernet

I have installed the pylptlib server 4200-SCS LPTlib server 1.1.2 as per the instructions. Now, I am not sure what IP address should this server indicate. In example programs given in the github repository of Keithley 4200, what TCP IP ADDRESS I should put. I am not able to find the detailed documentation about communicating with Keithley4200 using pylptlib via ethernet connection on a remote pc.

And one more thing I would like to ass is, on which computer we need to install the pylptlib server. Should be installed on Keithley 4200 or on a remote pc, this is quite confusing as no such things are mentioned anywhere.

2 Likes

Hello BhargavRJ,
You can find the new step-by-step 4200-SCS LPTlib server manual on our homepage. Alternatively, logged-in users can find the manual under Dashboard → Files → 4200-SCS LPTlib server manual.

Best,
Franz

2 Likes

Hello Franz,

Thanks a lot. This manual helped a lot and now I am able to ping the ip address. However when I try to run the example SMU_example.py the error I am facing is No module named ProxyClass

However I remember that I have installed the package using pip command.

Are you using the lptlib with the SweepMe! main software or in your own Python project?

The error message sounds like you are running a Python script but the lptlib folder is not within your Python PATH, which is why the ProxyClass cannot be imported.

1 Like

It is my own python project. How can I keep lptlib in my python PATH?

To run the lptlib as a client on an external measurement PC (While the server.exe is running on the 4200-SCS), you must import the tcp_client folder including the ProxyClass.py into your script, e.g. by calling from ProxyClass import Proxy.

You can do this by copying the folder into your project folder or adding the folder to your Python PATH.

2 Likes

Thanks, that solved the path issue.

Now I am facing below issue.

File “server.py”, line 95, in handle_request
File “server.py”, line 62, in run_command
File “pylptlib\lpt.py”, line 204, in forcev
File “pylptlib\lpt.py”, line 130, in check_error
ProxyClass.RemoteException: Server-side processing failed with K4200Error(‘Cannot force when not connected.’)

and also when i run it on sweepme application

image

2 Likes

The Cannot force when not connected. error can occur if your device contains an 4225-RPM or PMU module. One proven solution has been to call lpt.rpm_config(), which establishes the device connection (update the parameters with your own variables):

    self.lpt.rpm_config(
        instr_id=self.card_id,
        chan=self.pulse_channel,
        modifier=self.param.KI_RPM_PATHWAY,
        value=self.param.KI_RPM_PULSE,
    )

Concerning the error you receive in SweepMe!, can you please copy the complete debug message? You can find it in the debug widget of SweepMe!, which you can open by pressing “F2”.

1 Like

Below is the debug message from sweepme application

SweepMe! version 1.5.6.24

Debug: 20.1.2025 17:07:38 Run started

Time: 20.1.2025 17:07:38
Python Error:
Traceback (most recent call last):
File “PyInstaller\loader\pyimod03_ctypes.py”, line 77, in init
File “ctypes_init_.py”, line 374, in init
OSError: [WinError 193] %1 is not a valid Win32 application

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “MeasClasses.py”, line 2660, in wrapper
File “C:\ProgramData\SweepMe!\Devices\DC_82_1487_SMU-Keithley_4200-SCS\SMU-Keithley_4200-SCS\main.py”, line 239, in connect
ret = self.lpt.initialize()
File “C:\ProgramData\SweepMe!\Devices\DC_82_1487_SMU-Keithley_4200-SCS\SMU-Keithley_4200-SCS\libs\pylptlib\lpt.py”, line 102, in initialize
_dll = c.WinDLL(_dll_path)
File “PyInstaller\loader\pyimod03_ctypes.py”, line 79, in init
pyimod03_ctypes.install..PyInstallerImportError: Failed to load dynlib/dll ‘C:\s4200\sys\bin\lptlib.dll’. Most likely this dynlib/dll was not found when the application was frozen.


Debug: 20.1.2025 17:07:38 Run stopped

2 Likes

Hello Bhargav,
The line description in this error message does not match the current Keithley 4200-SCS driver version. Please update the driver using the Version Manager in SweepMe! via Tools → Modules&Devices → Search for SMU Keithley 4200-SCS. The currently newest version is 2024-11-18. If this version does not appear in your Version Manager you might need to update SweepMe.

Please let me know if the error remains.

1 Like

Time: 23.1.2025 16:52:53
Python Error:
Traceback (most recent call last):
File “MeasClasses.py”, line 2612, in wrapper
File “C:\ProgramData\SweepMe!\Devices\DC_82_1695_SMU-Keithley_4200-SCS\SMU-Keithley_4200-SCS\main.py”, line 602, in poweroff
self.lpt.forcev(self.card_id, 0.0)
File “C:\ProgramData\SweepMe!\Devices\DC_82_1695_SMU-Keithley_4200-SCS\SMU-Keithley_4200-SCS\libs\ProxyClass.py”, line 121, in handle_call
result_json = self.unpack_result(result)
File “C:\ProgramData\SweepMe!\Devices\DC_82_1695_SMU-Keithley_4200-SCS\SMU-Keithley_4200-SCS\libs\ProxyClass.py”, line 99, in unpack_result
reraise(
File “six.py”, line 718, in reraise
File “server.py”, line 95, in handle_request
File “server.py”, line 62, in run_command
File “pylptlib\lpt.py”, line 204, in forcev
check_error(err)
File “pylptlib\lpt.py”, line 130, in check_error
raise K4200Error(error_string % args)
ProxyClass.RemoteException: Server-side processing failed with K4200Error(‘Cannot force when not connected.’)


Debug: 23.1.2025 16:52:58 Run stopped

Hello Bhargav,
The error you sent contains the same message as before (‘Cannot force when not connected.’), but it is raised in the poweroff sequencer step. This means that the measurement should have run successfully before. Otherwise, the error would have occurred in apply or configure.

Which SweepMode are you using?
Can you please send the setting .set file that you want to run in SweepMe?

1 Like