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

Python API reference: command line arguments as list

#1
Hi,
I would like to make a suggestion for an improvement of the Python API reference. What I tried is starting
RoboDK using explicit input values (although these are the default values):


Code:
robodk_ip='localhost'
port=None
args=''
robodk_path='C:\\RoboDK\\bin\\RoboDK.exe'

RDK = Robolink(robodk_ip, port, args, robodk_path)

It raises a type error stating that a concatenation of list and string is not possible (see attachment). Looking into robolink.py it becomes clear that the inputs of robodk_path and args are being concatenated. Where robodk_path is transformed to a list automatically, args is handed over as it is declared in the first place (see attachment), in this case as a string.

The correct version of the code above would be:

Code:
robodk_ip='localhost'
port=None
args=[]
robodk_path='C:\\RoboDK\\bin\\RoboDK.exe'

RDK = Robolink(robodk_ip, port, args, robodk_path)


It is really not a big deal but it might be worth mentioning that command line arguments should be given as list:
https://robodk.com/doc/en/PythonAPI/robolink.html

Best Regards
David


Attached Files Thumbnail(s)
       
#2
Hi David,

Thank you for letting us know. We just updated the documentation.

We also improved this function to accept strings with the latest version (Windows 64 bit only, for now). Providing a string will behave as one argument (even if you have one or more spaces).

Albert
  




Users browsing this thread:
1 Guest(s)