Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difficulty running regetron in cmd

Tags:

python

regex

I want to follow the regex tutorial on http://regex.learncodethehardway.org/book/learn-regex-the-hard-waych1.html, but I am unsure how to execute regetron in cmd. I have followed the instructions to install it and the python interpreter does not give me an error when I type import regetron, so I know for certain it is installed.

like image 572
user1876508 Avatar asked Dec 05 '12 05:12

user1876508


2 Answers

Scripts usually get installed into the Scripts folder of your Python installation under Windows. Assuming you have Python 2.7 installed in the typical location, you should find a regetron executable in C:\Python27\Scripts.

FWIW, I typically put both C:\Python27 and C:\Python27\Scripts on my path under Windows for the above reason. Then commands introduced by packages are immediately available on the command line.

UPDATE: Regetron doesn't currently work for Windows. I've proposed a couple of patches to make it work. In the meantime, you can grab a new .zip from here and use pip to install it:

pip install .\regetron-1.4-windows.zip

UPDATE: My fixes have been incorporated into regetron. It should now work fine under Windows in a future version of regetron.

like image 157
John Szakmeister Avatar answered Nov 06 '22 05:11

John Szakmeister


I used Cygwin to run regetron, and I did the following:

  1. Install Cygwin, or update it if you already have it installed
  2. Install Python when you pick your packages to install. Install wget, too, because it'll make one of the steps below easier
  3. wget http://python-distribute.org/distribute_setup.py
  4. python distribute_setup.py
  5. Use easy_install to install PIP. PIP is actively maintained, and supports package removal (unlike easy_install): easy_install pip
  6. pip install regetron
  7. Run regetron: regetron

Another word of caution: cmd.exe handles single-quoted (')and double-quoted strings (") differently than *nix shells. I've been burned when I've run Python scripts that take regex arguments (e.g. pywikipediabot) in cmd.exe. You can follow examples exactly, and the Wrong Thing will happen.

Cygwin doesn't have problems with ' and ".

like image 20
rianjs Avatar answered Nov 06 '22 05:11

rianjs