0

I am new to lots of things.

I try to have Whoosh installed to look into the source code and play with it.

I add the path to folder containing setup.py and README.txt in sys.path, then

import setup

and error is displayed:

Traceback (most recent call last):
  File "C:/Users/Claire/Documents/Python_projects/Python_Open_Source/Whoosh1.py", line    6, in <module>
    import setup
  File "C:\Users\Claire\Documents\Python_projects\Python_Open_Source\Whoosh-     2.3.2\setup.py", line 20, in <module>
    long_description = open("README.txt").read(),
 IOError: [Errno 2] No such file or directory: 'README.txt'

when reaching this line in setup.py file:

long_description = open("README.txt").read(),

although sys.path entails the path to folder

C:\Users\Claire\Documents\Python_projects\Python_Open_Source\Whoosh-2.3.2\

Where does it come from, how to fix it?

Maybe I can only open a file in the path at the last position in sys.path?

Thanks and regards.

kiriloff
  • 25,609
  • 37
  • 148
  • 229
  • You probably want to execute setup.py - rather than import it as a module... "python setup.py" is the usual incantation. – aSteve Jan 22 '12 at 19:17
  • Thanks here. When I type in Python Shell (Idle, Windows 7) python setup.py it brings SyntaxError: invalid syntax. Do you have a hint for me? – kiriloff Jan 22 '12 at 20:02
  • `setup.py` is a Python script that is supposed to be run via the Python interpreter from the command line, **not** from within an interactive Python session (as in IDLE). Drahkar's answer below describes the process. – Chris Arndt Jan 22 '12 at 20:25
  • Thanks. I tried Drahkar's answer with cmd.exe (Windows 7) --> is working. And then tried with python command line. Same commands then give syntax error again. – kiriloff Jan 22 '12 at 20:46

1 Answers1

1

To install a new package into your python install you need to log into the package's directory and actually run the setup.py command. In your case, something like:

cd C:\Users\Claire\Documents\Python_projects\Python_Open_Source\Whoosh-2.3.2\

python ./setup.py build
python ./setup.py install

This should install the Whoosh modules into your python environment and make them available for import. This its just a matter of using the components withint he Woosh package as per their documentation here: http://packages.python.org/Whoosh/

Drahkar
  • 1,694
  • 13
  • 17