0

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?

Jacob Vlijm
  • 83,767
Frank
  • 9
  • 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 https://www.dropbox.com/s/dwcvsoqsjmo4qcn/ScreenCapture_11-23-2015%2011.57.43%20AM.wmv?dl=0 – Frank Nov 23 '15 at 17:12
  • Are you in the directory that ikfast_generator_cpp.py resides in? What does file ikfast_generator_cpp.py say? – stevieb Nov 23 '15 at 17:18
  • https://www.dropbox.com/s/dwcvsoqsjmo4qcn/ScreenCapture_11-23-2015%2011.57.43%20AM.wmv?dl=0 i feel that this videos show everyone where things are and what i want to do with it, why cant i get that pointer ? – Frank Nov 23 '15 at 17:59
  • 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
  • @MarkSmith this is what i got when i input your dir link sentinal@Xcorp:~$ cd ~/openrave-0.9.0-src/python then python ikfast_generator_cpp.py sentinal@Xcorp:~/openrave-0.9.0-src/python$ – Frank Nov 23 '15 at 18:08
  • Those are two separate commands - see my answer, I've also edited your question to try and make it clearer - I hope it contains everything relevant. – Mark Smith Nov 23 '15 at 18:29
  • @MarkSmith 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:59

2 Answers2

1

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

pwd

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

python ikfast_generator_cpp.py
Mark Smith
  • 1,283
  • 1
  • 11
  • 22
  • 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
0

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
Volker Siegel
  • 13,065
  • 5
  • 49
  • 65