RDFLib / pymicrodata

This a module to extract RDF from an HTML5 page annotated with microdata. The module implements the algorithm defined and published by the W3C Semantic Web Interest Group task force, in March 2012. The module can be used to produce serialized versions of the extracted graph, or simply an RDFLib Graph Object.
http://www.w3.org/2012/pyMicrodata/
Other
44 stars 10 forks source link

Undocumented Dependency on Paste? #1

Closed emmettbutler closed 11 years ago

emmettbutler commented 12 years ago

Below is a stacktrace that shows a dependency on the httpheader and httpexception modules

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/emmettbutler/git/CT/svc/mrschemato/<ipython-input-3-2adaec3e6e7c> in <module>()
----> 1 v.validate("docs/schema_errors.html")

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in validate(self, stream)
    236     def validate(self, stream):
    237         """frontend, prints a list of errors"""
--> 238         g = self.read_stream(stream)
    239         errors = self.check_graph(graph=g)
    240         ret = {}

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in read_stream(self, url)
    181         elif 'itemtype="http://schema.org/' in text:
    182             self.impl = schema
--> 183             from pyMicrodata import pyMicrodata
    184             self.parser = pyMicrodata()
    185         else:

/Library/Python/2.7/site-packages/pyMicrodata/__init__.py in <module>()
     54 __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231'
     55 
---> 56 import sys, StringIO, datetime, httpheader
     57 import os
     58 

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpheader.py in <module>()
    140 from rfc822 import formatdate, parsedate_tz, mktime_tz
    141 from time import time as now
--> 142 from httpexceptions import HTTPBadRequest
    143 
    144 __all__ = ['get_header', 'list_headers', 'normalize_headers',

ImportError: No module named httpexceptions

i was able to resolve this issue by downloading the Paste source from http://pypi.python.org/pypi/Paste/ and moving the httpheader.py and httpexceptions.py into my $PYTHONPATH. However, i wasn't able to find documentation of this dependency anywhere in the readme or documentation. I think this should probably be noted somewhere.

iherman commented 12 years ago

Emmett,

thank you. I am currently on vacations, but I will take care of that when I am back... (I have some other change plans on the code anyway)

Thanks again!

Ivan

On Jul 21, 2012, at 21:25 , Emmett J. Butler wrote:

Below is a stacktrace that shows a dependency on the httpheader and httpexception modules

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/emmettbutler/git/CT/svc/mrschemato/<ipython-input-3-2adaec3e6e7c> in <module>()
----> 1 v.validate("docs/schema_errors.html")

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in validate(self, stream)
   236     def validate(self, stream):
   237         """frontend, prints a list of errors"""
--> 238         g = self.read_stream(stream)
   239         errors = self.check_graph(graph=g)
   240         ret = {}

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in read_stream(self, url)
   181         elif 'itemtype="http://schema.org/' in text:
   182             self.impl = schema
--> 183             from pyMicrodata import pyMicrodata
   184             self.parser = pyMicrodata()
   185         else:

/Library/Python/2.7/site-packages/pyMicrodata/__init__.py in <module>()
    54 __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231'
    55 
---> 56 import sys, StringIO, datetime, httpheader
    57 import os
    58 

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpheader.py in <module>()
   140 from rfc822 import formatdate, parsedate_tz, mktime_tz
   141 from time import time as now
--> 142 from httpexceptions import HTTPBadRequest
   143 
   144 __all__ = ['get_header', 'list_headers', 'normalize_headers',

ImportError: No module named httpexceptions

i was able to resolve this issue by downloading the Paste source from http://pypi.python.org/pypi/Paste/ and moving the httpheader.py and httpexceptions.py into my $PYTHONPATH. However, i wasn't able to find documentation of this dependency anywhere in the readme or documentation. I think this should probably be noted somewhere.


Reply to this email directly or view it on GitHub: https://github.com/RDFLib/pymicrodata/issues/1


Ivan Herman Bankrashof 108 1183NW Amstelveen The Netherlands http://www.ivan-herman.net

iherman commented 12 years ago

Emmett,

the situation is slightly more stupid. Indeed, the httpheader, though imported, is not used:-( It was a copy-paste error.

I removed it from the code for the time being. There might be some future version of pyMicrodata that might require it, depending on the evolution of the microdata mapping; I will then do it properly, ie, with proper documentation in that case.

That aside, there was something else of interest. Although you clearly use a Mac and Python 2.7, there is no httpheader.py on my default installation (ie, under /System/Library/Frameworks/...). I use an older version of httpheader in my own library which, actually, does not make any use of the httpexception class either. I wonder why I have no httpheader installed on my python...

Thanks!

Ivan

On Jul 21, 2012, at 21:25 , Emmett J. Butler wrote:

Below is a stacktrace that shows a dependency on the httpheader and httpexception modules

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/emmettbutler/git/CT/svc/mrschemato/<ipython-input-3-2adaec3e6e7c> in <module>()
----> 1 v.validate("docs/schema_errors.html")

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in validate(self, stream)
   236     def validate(self, stream):
   237         """frontend, prints a list of errors"""
--> 238         g = self.read_stream(stream)
   239         errors = self.check_graph(graph=g)
   240         ret = {}

/Users/emmettbutler/git/CT/svc/mrschemato/mrSchemato/__init__.pyc in read_stream(self, url)
   181         elif 'itemtype="http://schema.org/' in text:
   182             self.impl = schema
--> 183             from pyMicrodata import pyMicrodata
   184             self.parser = pyMicrodata()
   185         else:

/Library/Python/2.7/site-packages/pyMicrodata/__init__.py in <module>()
    54 __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231'
    55 
---> 56 import sys, StringIO, datetime, httpheader
    57 import os
    58 

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpheader.py in <module>()
   140 from rfc822 import formatdate, parsedate_tz, mktime_tz
   141 from time import time as now
--> 142 from httpexceptions import HTTPBadRequest
   143 
   144 __all__ = ['get_header', 'list_headers', 'normalize_headers',

ImportError: No module named httpexceptions

i was able to resolve this issue by downloading the Paste source from http://pypi.python.org/pypi/Paste/ and moving the httpheader.py and httpexceptions.py into my $PYTHONPATH. However, i wasn't able to find documentation of this dependency anywhere in the readme or documentation. I think this should probably be noted somewhere.


Reply to this email directly or view it on GitHub: https://github.com/RDFLib/pymicrodata/issues/1


Ivan Herman Bankrashof 108 1183NW Amstelveen The Netherlands http://www.ivan-herman.net

emmettbutler commented 12 years ago

There wasn't any httpheader in my default installation either, I'm not sure why.

I'm soon going to be open-sourcing a schema validator that uses this library and pyRdfa, so I want to make sure that all of the requirements are in place.