[Neo] Syntax error when using neo4j.py

2009-09-15 Thread Alex Stuart
Hi,

I am attempting to write a Python script to do some basic transactions 
with a Neo4j database. I'm using Jython 2.5rc1 and the latest neo4j.py 
module on Ubuntu 9.04.

When I try to follow the code example on the neo4j.py page, I use the 
with statement as it shows:

from neo4j import NeoService
   neo = NeoService( /neo/db/path )
   with neo.transaction:
   ref_node = neo.reference_node
   new_node = neo.node()
   # put operations that manipulate the node space here ...
   neo.shutdown()


However, when the with statement is parsed, the interpreter stops and 
returns the following syntax error:

Syntax Error: 'with' will become a reserved word in Python 2.6

I've tried a bunch of different code and searched around for other 
people having this problem, but to no avail. All of my stuff is up to 
date, so why would the basic recommended code break on my system?

--Alex



___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] Syntax error when using neo4j.py

2009-09-15 Thread Brian King
Hi Alex,

try using this line at the top of your python file:

from __future__ import with_statement

Brian

On Tue, Sep 15, 2009 at 7:52 PM, Alex Stuart dstu...@cs.umn.edu wrote:
 Hi,

 I am attempting to write a Python script to do some basic transactions
 with a Neo4j database. I'm using Jython 2.5rc1 and the latest neo4j.py
 module on Ubuntu 9.04.

 When I try to follow the code example on the neo4j.py page, I use the
 with statement as it shows:

 from neo4j import NeoService
   neo = NeoService( /neo/db/path )
   with neo.transaction:
       ref_node = neo.reference_node
       new_node = neo.node()
       # put operations that manipulate the node space here ...
   neo.shutdown()


 However, when the with statement is parsed, the interpreter stops and
 returns the following syntax error:

 Syntax Error: 'with' will become a reserved word in Python 2.6

 I've tried a bunch of different code and searched around for other
 people having this problem, but to no avail. All of my stuff is up to
 date, so why would the basic recommended code break on my system?

 --Alex



 ___
 Neo mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user