Python: Using RDFLIB to graph a Sesame database

Is it possible to draw a graph of a Sesame RDF database using RDFLIB? This is what I tried:

endpoint = "http://127.0.0.1:8080/openrdf-workbench/repositories/movies/explore?resource=%3Cfile%3A%2F%2Fmovies_export.rdf%3E"

from rdflib import Graph
g = Graph()
g.parse(endpoint)

This is the error:

Traceback (most recent call last):
  File "C:\Software\rdflib\movieGraph.py", line 10, in <module>
    g.parse(endpoint)
  File "c:\python26_32bit\lib\site-packages\rdflib\graph.py", line 756, in parse
parser = plugin.get(format, Parser)()

File "c:\python26_32bit\lib\site-packages\rdflib\plugin.py", line 89, in get
raise PluginException("No plugin registered for (%s, %s)" % (name, kind))
rdflib.plugin.PluginException: No plugin registered for (application/xml, <class
'rdflib.parser.Parser'>)

I think the only trick is specifying a proper URL to cause Sesame to return a .rdf xml layout.

Your endpoint URL is wrong. It points to the Sesame Workbench, which is not a (SPARQL) endpoint, but a client application. The SPARQL endpoint for any Sesame database is always on the Sesame server, and is equal to the repository URL. In your case, probably http://127.0.0.1:8080/openrdf-sesame/repositories/movies.

(edit) Looking at what you're doing, I think you do not need a SPARQL endpoint but just want an export of the complete Sesame database. For this, you can use http://127.0.0.1:8080/openrdf-sesame/repositories/movies/statements. See the Sesame HTTP communication protocol for more details.

RDFExtras has a store implementation that wraps a SPARQL endpoint, giving you a read-only graph:

store=rdfextras.store.SPARQL.SPARQLStore("http://dbpedia.org/sparql")
g=rdflib.Graph(store)

This is built on the SPARQLWrapper library, which gives you a lower-level interface to do the same thing.