Python script triggered by UPM doesn't work properly
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-06-2015 12:22 PM
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?
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
Any suggestions?
21 REPLIES 21
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-17-2015 12:40 PM
What was the problem? 🙂
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-17-2015 07:31 AM
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.
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
I can't even execute single-line script "from exos import api". You can see traceback in previous post.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-13-2015 09:10 AM
You need to run EXOS 15.7 minimum in order to create Python App (process). Are you running 15.6 ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-13-2015 09:10 AM
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?
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?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎11-13-2015 09:10 AM
oh, I misread, sorry.
Try that :
from exos import api
instead of
from xos import api
Try that :
from exos import api
instead of
from xos import api
