ISISComputingGroup / lewis-ess

Let's write intricate simulators!
GNU General Public License v3.0
21 stars 19 forks source link

What is the correct way to add new devices? #275

Closed chansdad closed 4 years ago

chansdad commented 4 years ago

I am trying to create new devices , when I follow the user guide and place a device under its own folder including its init.py as well as an empty init.py file and then run lewis with -k option i am not able to find the devices

I keep getting Please specify a device to simulate. The following devices are available: with no devices .

I also set the PYTHONPATH to the root level of the devices if the PYTHONPATH is not set , i am seeing

Failed to import module 'device1' for device discovery. Make sure that it is in the PYTHONPATH. See also the -a option of lewis.

chansdad commented 4 years ago

Adding tot he above , i even tried to grab the entire src and then updating the PYTHONPATH variable so i can see the devices available , but with could not .

$ export PYTHONPATH=/lewis/src/lewis $ lewis -k examples.simple_device Please specify a device to simulate. The following devices are available:

No available device under examples is printed ..

Appreciate any help to resolve this issue. Thanks in advance

chansdad commented 4 years ago

Ok , never mind , user guide was not clear . This helped . Setting the PYTHONPATH to the folder which required -k to be passed worked.

/some/host/path         <-- Must point -a here
├─ devices/             <-- Must name this using -k
│  ├─ epics_device/     <-- Must name this as positional argument
│  │  └─ ...
│  ├─ stream_device/
│  │  └─ ...
│  └ __init__.py        <-- Must exist