1

For test purposes, I work under OS Windows 7, use python and py2neo to connect to a Neo4j server (all on the same machine).

I'd like to check the server connection status from python and be able to (re)boot and stop the server, etc...

According to the Neo4j manual the server, the py2neo server API is designed for Linux. I tried it on Windows and the commands don't work

Is there a way or other packages in python to interact with the Neo4j server from a Windows environment?

Goofball
  • 735
  • 2
  • 9
  • 27

1 Answers1

1

I think checking the server status is idependent of the OS. A simple way would be to ask for the neo4j version with py2neo:

import py2neo

graph = py2neo.Graph()
try:
    print(graph.neo4j_version)
except FindCorrectErrorHere:
    print("server not available")

If you want to run a system call, subprocess.call() should do the trick.

It is OS independent, replaces os.system() and you can call whatever people call to start neo4j on Windows.

See also this question: Running windows shell commands with python

Community
  • 1
  • 1
Martin Preusse
  • 9,151
  • 12
  • 48
  • 80