Andrew Sackville-West wrote:
> Hi list,
>
> I am new to python and old to coding (as in I did it a long time
> ago). I've got a task that cries out for a scripted solution --
> importing chunks of ASCII data dumps from a point-of-sale system into
> an openoffice.org spreadsheet. What a great chance for me to get my
> coding skills back and learn python too!
>
> I have attempted to get ooopy to work for me and have run into
> problems at the first step. Google returns not much on ooopy and the
> common example, from help (OOoPy) is:
>
>      |  from OOoPy import OOoPy
>      |  >>> o = OOoPy (infile = 'test.sxw', outfile = 'out.sxw')
>      |  >>> e = o.read ('content.xml')
>      |  >>> e.write ()
>      |  >>> o.close ()
>
> okay here goes:
>
> >>> from OOoPy import OOoPy
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named OOoPy
>
> hmm... okay how about:
>
> >>> from ooopy import OOoPy
> >>> dir (OOoPy)
> ['ElementTree', 'OOoElementTree', 'OOoPy', 'StringIO', 'VERSION',
> 'ZIP_DEFLATED', 'ZipFile', '__builtins__', '__doc__', '__file__',
> '__name__', '_autosuper', 'autosuper', 'fromstring', 'mkstemp', 'os']
>
> okay that works. now:
>
> >>> o = OOoPy (infile='/home/andrew/monthly.ods')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: 'module' object is not callable
> >>>

OK, so that tells you that ooopy.OOoPy is a *module*, and it contains
*another* gizmoid named OOoPy.

[snip]
> >>> sys.modules
[snip]
> 'ooopy.OOoPy': <module 'ooopy.OOoPy' from
> '/usr/lib/python2.4/ooopy/OOoPy.py'>,

Uh-huh. Confirmation that ooopy.OOoPy is a module.

Try:

from ooopy import OOoPy
o = OOoPy.OOoPy(infile='/home/andrew/monthly.ods')

BTW, is that package being maintained? Did you ask the maintainer? Any
response?

HTH,
John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to