I have a file called ikfast_generator_cpp.py in a directory called openrave-0.9.0-src/python under my home directory.

How do I run it in Python?

  • In a terminal, typing python myfile.py will run myfile.py. If that doesn't help, perhaps you'd like to rephrase the question, minus the rant, and perhaps someone can be of more help. Good luck. – Mark Smith Nov 23 '15 at 16:40
  • @MarkSmith this is what i got when i did what you asked ubuntu@frank:~$ python ikfast_generator_cpp.py python: can't open file 'ikfast_generator_cpp.py': [Errno 2] No such file or directory sentinal@Xcorp:~$ – Frank Nov 23 '15 at 16:55
  • That sounds a lot like the file isn't there. Does it show up when you type ls -l ? – Mark Smith Nov 23 '15 at 17:02
  • @MarkSmith check out this short please Mark dropbox.com/s/dwcvsoqsjmo4qcn/… – Frank Nov 23 '15 at 17:12
  • 1
    To answer your question about how to get better help - edit your question to be clearer and without the rant. Regarding the procedure in your video, navigating to that folder in the file browser doesn't cause the terminal you open later to be in that location - it wouldn't on Windows either. Try this: open terminal, cd ~/openrave-0.9.0-src/python then python ikfast_generator_cpp.py. The command ls is a shell command (like dir in Windows), not a Python command. – Mark Smith Nov 23 '15 at 18:04

Start a terminal by clicking the appropriate icon on the left side of the screen.

In the terminal, change the current directory to the location of your file:

 cd ~/openrave-0.9.0-src/python

(The ~ means "my home directory". I hope the rest of the line is clear.)

You should see the prompt change to include the new location. If you like you can check by typing


Now run the Python interpreter, giving it the name of the file to run:

python ikfast_generator_cpp.py
  • sentinal@Xcorp:~$ I type in sentinal@Xcorp:~$ cd ~/openrave-0.9.0-src/python then python ikfast_generator_cpp.py then i hit the ls and i can see the file i want to run is called ikfast.py so right after i hit ls and i see what i want i type that name here like so sentinal@Xcorp:~/openrave-0.9.0-src/python$ ikfast.py and i get this ikfast.py: command not found – Frank Nov 23 '15 at 18:45
  • Go back through my answer, which explains what the commands do, as well as the commands to type. You have the command there to run a Python program called ikfast_generator_cpp.py. See if you can work out what you might do to run a Python program with a different name. – Mark Smith Nov 23 '15 at 20:20

To locate the file use:

$ locate ikfast_generator_cpp.py

Then when you find the path it is in, copy the path and use the following command below.

Lets say the path to your file is openrave-0.9.0-src/python/ikfast_generator_cpp.py.

To run an executable .py (Python) file, use the command:

$ ./openrave-0.9.0-src/python/ikfast_generator_cpp.py

or if it is not executable use:

$ python openrave-0.9.0-src/python/ikfast_generator_cpp.py

Not the answer you're looking for? Browse other questions tagged or ask your own question.