Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Issue running script from command line

#1
I have an issue where if I run a Python script from within the station tree on the robot, it works as expected, yet if I attempt to run the same script from the Windows command line it does not work at all. I am using the latest version of RoboDK. The script is very simple:

Code:
from robodk.robolink import *
from robodk.robodialogs import *
from robodk.robomath import *
RDK = Robolink()
UR5 = RDK.Item('UR5', ITEM_TYPE_ROBOT)
wo_pt_maz_1 = [-2.02, -76.38, -149.96, -137.34, -47.08, -217.2]
UR5.MoveJ(RDK.Item('Home', ITEM_TYPE_TARGET), True)
UR5.MoveJ(wo_pt_maz_1, True)

When attempting to run from the command line I type:

Code:
C:\RoboDK\Python-Embedded>python c:\path-to-my-file\test_1.py

Is someone please able to explain why it does not run from the command line?


Attached Files
.rdk   2020350569 Station 2022.rdk (Size: 13.58 MB / Downloads: 133)
.py   test_1.py (Size: 308 bytes / Downloads: 138)
#2
Running scripts externally should work. What issues do you see when you run your Python script from the command line?

Is RoboDK running with your project open? If not, RoboDK will start automatically but you should load your RDK project file using AddFile.
#3
When the script is run from the command line, the robot fails to move. Print() statements in the Python file result in output to the command line as expected, so the script is certainly being run, but the robot (a UR5) fails to obey the movej() commands contained within the script. Per the OP, if I drag the script into the station tree it works perfectly fine, so the issue is not with the content of the script itself. Note that RoboDK is running with the RDK project file open when I attempt to run the script from the command line.
#4
What exact issues are you seeing after running the python script from the command line?

You may need to update the RoboDK package for Python:
Code:
pip install robodk
or
python -m pip install robodk
  




Users browsing this thread:
1 Guest(s)