Python Scripts Directory

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered

I'm starting to get a number of pythons scripts on my switches/stacks.  From what I can tell if I create a directory and move the scripts into it I'm not able to execute them.  Even if I cd into the directory, I'm still not able to run them.  It looks like they have to be in the /usr/local/cfg directory.  I just want to make sure that I'm not missing anything.

I'm running ExOS


Photo of bw447


  • 966 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Matthew Helm

Matthew Helm, Employee

  • 1,852 Points 1k badge 2x thumb
The run script and load script will expect the target script file to be in the directory you are currently in. So, if I cd into a subdirectory off of /usr/local/cfg and then run script {}, that script will be executed. However, were I to cd back to the /usr/local/cfg directory, and try that same command, I will get a file not found error, or even if I run script ./{subfolder}/{}, that will give me an invalid filename error.
Photo of Grosjean, Stephane

Grosjean, Stephane, Employee

  • 13,672 Points 10k badge 2x thumb
That has been fixed in 16.2.2p1-3 (or whatever the patch number was), so it's also available with latest 16.2.3.
Photo of Dave Hammers

Dave Hammers, Dir SW Engineering

  • 3,782 Points 3k badge 2x thumb
Stephane is correct:
The bug tracker number for:
xos0066610 run script python does not look in the current working directory for scripts
is fixed in
Photo of bw447


  • 966 Points 500 badge 2x thumb
Thank you everyone for the help!