views:

51

answers:

1

I am using Eclipse with the PyDev plugin. I am using xlwt which is for writing to an excel sheet. I have the xlwt library in my src file. I have another python file called gene_sorter.py where i try to import xlwt. using

import xlwt

I keep gettting back this error:

 File "C:\Documents and Settings\Ben Fossen\Pythonworkspace\MTBgenes\src\gene_sorter.py", line 1, in <module>
from xlwt import *

File "C:\Documents and Settings\Ben Fossen\Pythonworkspace\MTBgenes\src\xlwt\__init__.py", line 10, in <module>
from Workbook import Workbook
ImportError: No module named Workbook

I am new to using PyDev and eclipse so mabye I am making a simple mistake. I can't seem to see what I am doing wrong. I am using a new enough version of python so that shouldn't be a problem. Has anyone else had this problem it seems very strange?

+1  A: 

"New enough version of Python" could well be "too new"; please edit your question to show the actual version number. In future, don't be coy; save the time and energy of everybody (including yourself) by including such essential information in your question.

If you are trying to run it under Python 3.1:

  • Don't bother; it's not supported (yet).
  • Please say where you got the notion that it was supported on 3.X, so that it can be corrected.

Otherwise:

  • Any particular reason why you wouldn't just run the Windows installer and install it in the default directory?
John Machin
Yes I am using Python 3.0. I see thats my mistake i didn't read it carefully enough I just saw it was supported on 2.3+ and didn't see the 2.6 part. Thanks for catching that. No there is no particular reason, I will give that a try.
Ben Fossen
`xlwt` is also supported on 2.7 -- give that a go. In any case, Python 3.0 should be dead and buried; it was a proof of concept. Use 3.1 if you want to dabble in 3.X. Very few people will purport to support a package running under 3.0 -- the general chorus is "Update to 3.1".
John Machin
Ok thats good to know. Is xlrd also supported by 2.7?
Ben Fossen
Yes, `xlrd` is supported on Python 2.7.
John Machin