Hi Jiang. First, TorCtl is being deprecated by two newer (more actively developed) controller libraries...
Stem (https://stem.readthedocs.org/en/latest/) - Threaded library with a similar design to TorCtl. Txtorcon (https://txtorcon.readthedocs.org/en/latest/) - Twisted based controller library.
Please try one of those. Here's a tutorial that should help you with getting started...
https://stem.readthedocs.org/en/latest/tutorial.html#the-little-relay-that-c...
- with command "tor", when it establishes, if I run example.py
the result is "Connection refused. Is the ControlPort enabled?"
Maybe the browser bundle uses a non-standard port or a control socket? By default TorCtl and Stem look for 9051 since that's the default control port by convention. The browser bundle pops up an instance of Vidalia and you can look in its settings for the details of how it connects to Tor.
Simplest solution is to not use the browser bundle at all, and instead make a text file with...
ControlPort 9051 CookieAuthentication 1
... then start Tor with "tor -f /path/to/that/file". The example you're running should then work.
Cheers! -Damian