Thanks Allan - I (wrongly) assumed that it was good practice to avoid reopening the connection each time. Things do work fine with your suggested solution then.. now moving on to grammars and scopes :-)
Best, m 

On 3 October 2015 at 12:15, Allan Odgaard <> wrote:
On 17 Sep 2015, at 1:03, Michele Pasin wrote:

The problem is, Python's pickle doesn't support all kinds of objects, and
sockets are among those […] So I wonder if there's another way of approaching the problem; or, if by any chance, the same approach done via another language (eg Ruby) would not
encounter any limitation.

I am not sure why you want to reuse the socket.

The server will run and keep listening on port 7099.

Each time you run the command, it will have to create a new connection to the server, but the server can keep state, as it will not terminate between connections/command invocations.

You can use TM_DOCUMENT_UUID or TM_PROJECT_UUID as client ID for the server, so that the server can maintain a “session” per document/project.

Creating a new connection to the server per request is not uncommon or expensive when server is running on localhost.

textmate mailing list