Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've installed docutils on my Mac OS system following the docutils instructions.

I've also done:

$ sudo cp tools/buildhtml.py tools/rst2html.py /usr/local/bin

However, if I open a command line and type rst2html, I get 'command not found'.

If I type rst2html.py, there's no problem, so the Python file itself is on my path.

How do I get my system to recognize rst2html as a valid command?

Thanks!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I don't know about mac, but generally in a Unix system the file extension isn't implied. Indeed a file name extension rarely has any special meaning at all. However there are lot of Unix tricks to help you, perhaps creating a symbolic link:

$ sudo ln -s rst2html.py /usr/local/bin/rst2html
share|improve this answer
    
Thank you... :) –  AP257 Mar 16 '11 at 14:55
add comment

When you type the command rst2html on the command line, it's going to look for a program called rst2html (not rst2html.somethingorother) in the directories in your PATH. If you want rst2html to work, you need a file named rst2html. There are several ways to do this:

  1. Rename the program. There's no actual need for the .py extension, as the system knows it's a Python script because of its shebang line.

    sudo mv /usr/local/bin/rst2html.py /usr/local/bin/rst2html
    
  2. Hard-link the program. You can have the program listed in /usr/local/bin under two different names, rst2html.py and rst2html, and either one can be used to launch it.

    sudo ln /usr/local/bin/rst2html.py /usr/local/bin/rst2html
    
  3. Symbolic-link the program. Similar to hard-linking, except that only one is the "real" file, the other is just a unix-style alias. This may be a bit easier to manage than hard-linking, because if you ever install an updated version, the link will automatically use the new version (while with a hard link, you'd need to update the link manually).

    sudo ln -s rst2html.py /usr/local/bin/rst2html
    

Personally, I'd just rename it (option 1), but either of the other options should work fine as well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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