marianoguerra / rst2html5

transform restructuredtext documents to html5 + twitter's bootstrap css, deck.js or reveal.js
http://marianoguerra.github.com/rst2html5
MIT License
177 stars 51 forks source link

Dont work function instead class #11

Closed josx closed 12 years ago

josx commented 12 years ago

Traceback (most recent call last): File "./rst2html5", line 19, in import html5css3 File "/home/josx/Desarrollo/rst2html5/html5css3/init.py", line 35, in from html import * File "/home/josx/Desarrollo/rst2html5/html5css3/html.py", line 19, in class TagBase(ET.Element): TypeError: Error when calling the metaclass bases function() argument 1 must be code, not str

Maybe this http://stackoverflow.com/questions/2231427/error-when-calling-the-metaclass-bases-function-argument-1-must-be-code-not

I am testing with pyhton 2.6

marianoguerra commented 12 years ago

that's weird.

can you run this on the python shell?

import xml.etree.ElementTree as ET
ET.Element

I get this

>>> import xml.etree.ElementTree as ET
>>> ET.Element
<class 'xml.etree.ElementTree.Element'>
josx commented 12 years ago

import xml.etree.ElementTree as ET ET.element Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'element'

marianoguerra commented 12 years ago

uppercase e for Element

ET.Element

josx commented 12 years ago

Sorry about that.

Here:

ET.Element function Element at 0xb7a72294

marianoguerra commented 12 years ago

there's the problem, you seem to have something different installed.

tell me the output of

>>> ET.VERSION

mine is

'1.3.0'

also the first lines of running

>>> help(ET)

mine is:

    Help on module xml.etree.ElementTree in xml.etree:                     

    NAME                                                                   
        xml.etree.ElementTree                                              

    FILE                                                                   
        /usr/lib/python2.7/xml/etree/ElementTree.py                        

    MODULE DOCS                                                            
        http://docs.python.org/library/xml.etree.ElementTree               

    DESCRIPTION                                                            
        # ElementTree                                                      
        # $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $          
        #                                                                  
        # light-weight XML support for Python 2.3 and later.               
        #                                                                  
        # history (since 1.2.6):    
josx commented 12 years ago

Ok, So thats the problem. I will try to update this library

ET.VERSION '1.2.6'

Help on module xml.etree.ElementTree in xml.etree:

NAME xml.etree.ElementTree

FILE /usr/lib/python2.6/xml/etree/ElementTree.py

MODULE DOCS http://docs.python.org/library/xml.etree.ElementTree

DESCRIPTION

ElementTree

# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $
#
# light-weight XML support for Python 1.5.2 and later.
#
# history:
# 2001-10-20 fl   created (from various sources)
# 2001-11-01 fl   return root from parse method
# 2002-02-16 fl   sort attributes in lexical order
# 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup
# 2002-05-01 fl   finished TreeBuilder refactoring
# 2002-07-14 fl   added basic namespace support to ElementTree.write
# 2002-07-25 fl   added QName attribute support
# 2002-10-20 fl   fixed encoding in write
# 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding
# 2002-11-27 fl   accept file objects or file names for parse/write
# 2002-12-04 fl   moved XMLTreeBuilder back to this module
# 2003-01-11 fl   fixed entity encoding glitch for us-ascii
# 2003-02-13 fl   added XML literal factory
josx commented 12 years ago

You need to have at least installed python2.7

Reading documentation:

Changed in version 2.7: The ElementTree API is updated to 1.3. For more information, see Introducing ElementTree 1.3.

marianoguerra commented 12 years ago

the last commit should fix it, tell me if it didn't worked.

marianoguerra commented 12 years ago

thanks for reporting!

josx commented 12 years ago

Now It's Working

I have trouble with the deckjs submodule.

For documentation:

To also get deckjs you have to:

git clone --recursive https://github.com/marianoguerra/rst2html5.git

or after clone

git submodule update --init
marianoguerra commented 12 years ago

added to the readme, thanks!