mattharrison / rst2odp

Create OpenOffice.org (impress) slideshows from restructured text (rst) or python
MIT License
27 stars 16 forks source link

Support Python 2.7 #6

Closed mortenlj closed 12 years ago

mortenlj commented 12 years ago

I've just started writing a presentation, and decided I wanted to use rst as a source. I figured I would use S5, but then I found out about rst2odp, and figured using Impress to run the presentation works better than a browser.

Unfortunately, I only have Python 2.7.2 available on any of my systems. Python 2.7.x has been the standard on many distributions for a while now...

If you could explain why/where Python 2.7 isn't supported, I might be able to contribute some patches.

mattharrison commented 12 years ago

I'm not sure what errors you are seeing. I used rst2odp with python 2.7 just last week.

Some sample slides, your platform and the error you are seeing would help diagnose your problem.

cheers

mortenlj commented 12 years ago

https://github.com/mattharrison/rst2odp/blob/master/bin/rst2odp [line 976-977] gave me the impression that it is intentional that 2.7 isn't supported.

Anyway, if I comment out those two lines, I get this error:

    (python101)PS C:\Documents and Settings\mortenlj\My Documents\My Projects\python101\src> rst2odp.py --traceback .\python101.rst .\python101.odp
    Traceback (most recent call last):
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101/Scripts\rst2odp.py", line 981, in <module>
        sys.exit(main(sys.argv) or 0)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101/Scripts\rst2odp.py", line 968, in main
        enable_exit_status=enable_exit_status)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\docutils\core.py", line 212, in publish
        output = self.writer.write(self.document, self.destination)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\docutils\writers\__init__.py", line 77, in write
        self.translate()
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101/Scripts\rst2odp.py", line 120, in translate
        self.parts['whole'] = self.visitor.get_whole()
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101/Scripts\rst2odp.py", line 162, in get_whole
        return self.preso.get_data(self.settings.template_file)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\odplib\preso.py", line 188, in get_data
        zip_odp = self.to_file()
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\odplib\preso.py", line 221, in to_file
        out.touch('content.xml', self.to_xml())
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\odplib\preso.py", line 302, in to_xml
        return to_xml(self._root)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\odplib\preso.py", line 123, in to_xml
        etree.write(fout)
      File "C:\Documents and Settings\mortenlj\.virtualenvs\python101\lib\site-packages\odplib\preso.py", line 103, in write
        self._write(file, self._root, encoding, NS2PREFIX)
    AttributeError: 'PrefixedWriter' object has no attribute '_write'

This is on WindowsXP, with Python 2.7.2, source-checkout of docutils and rst2odp:

    svn+https://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils/
    git+https://github.com/mattharrison/rst2odp.git
    pygments==1.4

Presentation source is at https://bitbucket.org/mortenlj/python101

mattharrison commented 12 years ago

Whoops, I looked and had made changes on my 2.7 computer without pushing. They are pushed now. Let me know if they help...

mortenlj commented 12 years ago

Looks like it works now, atleast it generates an odp-file without any errors from my presentation (after I comment out the admonitions which isn't implemented).

I'm closing this issue, as Python 2.7 support seems to be working after that last commit. :)

(There is however a problem with the file it generates, but I've managed to get a Python 2.6 installation running, and I get the same problem there, so I'll investigate further and possibly open a new issue for that problem).