Python and Astor

Dear all,

I am slowly learning how to use Tango-CS. I have successfully installed all necessary tools on a VM. I have even managed to set up a few C++ device servers and instances of these. I can operate (start/stop) the device servers via Astor, and also configure them via Jive.

I am now creating a replica device server in Python. I can start/stop these device servers via the terminal with a command like:
python PythonDS.py test

After which, Astor lights 'green' for this device server. However I am unable to actually start the device server from within Astor itself (in the same way I can turn on device servers for C++). The error I get is:

PythonDS: not found in 'StartDsPath' property: - /home/andrea/Documents/AAVS/Tango/dev

This is the path where all my device servers (C++ executables or python files are located), and I have setup Tango to look for device servers there (via StartDsPath). So Astor startup works for C++, but not for Python.

Am I missing something?

Thank you all for any suggestions and help.
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Hi,

The Starter can only start executable file. Your py script is not.

You have to create a file without extension PythonDS which contains :

#!/usr/bin/env python
# PythonDS device server launch script 

from PythonDS import main

if __name__ == '__main__':
   main()

Normally, with that you will be ok and the Starter will be able to launch PythonDS.
Edited 8 years ago
Hi,

Thanks a lot for your message.

I have been unsuccessful so far. Let us assume I have generated a new python device server from POGO. I add nothing to the standard POGO template. This file is called PSDS.py

I can configure this server in Jive, and start it via "python PSDS.py test" - that works fine, and Astor can detect it as running (green) as well.

Now assuming I do not start it via command line, I can still create the new server via Jive.
I have an additional file called PSDS (no extension) with the code:

#!/usr/bin/env python
# PSDS device server launch script 

from PSDS import main

if __name__ == '__main__':
   main()

Astor can now find the device, and adds it to my list of devices. However the device is Red, and can't start from within Astor. If I start the device server from command line, it turns green.

Thanks for your help :)
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
Exactly !

Maybe I can add the windows part too :

You have to create a .bat file.

For your example :

PSDS.bat containing:

python c:/MyPath/PSDS.py %1 %2

We need the argument %& and %2 to be able to call the script for several instances of this server.
Hi again,

So with Python device servers, you definitely need some sort of external batch file, or python command etc. Astor alone can't be the "batch" process itself.

That's not a problem of course - I can create a shell script like the one above, no problem.

Thanks a lot for your help! :)
Dr Andrea DeMarco, BSc (Hons) (Melita), MSc (Melita), DPhil (UEA)
Lecturer | Researcher
Department of Physics
Institute of Space Sciences and Astronomy

Room 220, Maths and Physics Building
University of Malta, Msida MSD2080, MALTA
 
Register or login to create to post a reply.