cancel
Showing results for 
Search instead for 
Did you mean: 

Python script triggered by UPM doesn't work properly

Python script triggered by UPM doesn't work properly

eyeV
New Contributor III
Hi everybody.
I use x480 with 16.1.2.

I have simple .py script like this.
import pexpect
import exsh
exsh.clicmd ('create log message "Starting NSCBackup!"')
for i in range(1,10):
print(i)
p = pexpect.spawn('/exos/bin/ssh -r 2 USERNAME@172.20.1.' + str(i))
idx = p.expect(['password', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('SECRETPASS')
idx = p.expect(['sCore', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('create log message "Not so cold backuper"')
idx = p.expect(['sCore', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('save')
idx = p.expect(['(y/N)', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('y')
idx = p.expect(['sCore', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('scp2 vr "VR-Default" sCore' + str(i) + '.cfg USERNAME@172.20.1.10:sCore' + str(i) + '.cfg')
idx = p.expect(['password', pexpect.EOF, pexpect.TIMEOUT])
p.sendline('SECRETPASS')
p.sendline('exit')Not so beautiful, but it works!

So... I can run it with "load script NSCB.py". It works properly.

Then I created and scheduled UPM profile like this.
create upm profile NSCB
load script NSCB.py
.
create upm timer NSCBtimer
configure upm timer NSCBtimer profile NSCB
configure upm timer NSCBtimer at 11 5 2015 23 50 0 every 86400And I run it:
run upm profile "NSCB" I see some log messages, but script stucked.
11/06/2015 15:55:19.94 Starting NSCBackup!
11/06/2015 15:55:19.54 Launched profile NSCB for the event user-request

Any suggestions?
21 REPLIES 21

Drew_C
Valued Contributor III
What was the problem? 🙂

eyeV
New Contributor III
It's not the version problem. I've tried 16.1.1.4, same result. The script doesn't run with upm profile.

create upm profile NSCB
run script NSCB-old.py

run upm profile "NSCB"
11/17/2015 11:26:53.88 Starting NSCBackup!
11/17/2015 11:26:53.44 Launched profile NSCB for the event user-request
I can't even execute single-line script "from exos import api". You can see traceback in previous post.

Stephane_Grosj1
Extreme Employee
You need to run EXOS 15.7 minimum in order to create Python App (process). Are you running 15.6 ?

eyeV
New Contributor III
Same result...

Traceback (most recent call last):
File "/config/NSCB.py", line 2, in
from exos import api
File "/exos/tools/lib/python2.7/site-packages/exos/api/__init__.py", line 21, in
File "/exos/tools/lib/python2.7/site-packages/exos/api/ems.py", line 10, in
ImportError: No module named _exos_ext_ems

What XOS version do you run?

oh, I misread, sorry.

Try that :

from exos import api

instead of

from xos import api
GTM-P2G8KFN