0 votes
38 views

I'm trying to connect to OpenLCA using the olca-ipc Python library via IPC (not REST), but I keep encountering an unexpected HTTPConnectionPool error, which seems to indicate it's trying to connect via REST.

Setup:

  • Python version: 3.11.12

  • olca-ipc version: 2.4.0

  • olca-schema version: 2.4.0

  • OpenLCA version: 2.3.1

This is the code I wrote:

import olca_ipc as ipc

import olca_ipc.protocol as protocol

import olca_ipc.rest as rest

import olca_schema as o

client: protocol.IpcProtocol

use_rest = False  # MAKE SURE this is set to False

if use_rest:

    print('Connected to a remote OpenLCA server')

    client = rest.RestClient("http://localhost:8080")

else:

    print('Connected to a local OpenLCA (IPC)')

    client = ipc.Client(8080)

print(f"Client type: {type(client)}")

# Ping OpenLCA

try:

    print("Calling get_all()...")

    processes = client.get_all(o.Process)

    print("Call to get_all() succeeded.")

    print(f"Ping successful: Retrieved {len(processes)} processes from OpenLCA")

except Exception as e:

    print(f"Ping failed: {e}")

The output I get is this:

Connected to a local OpenLCA (IPC) 

Client type: <class 'olca_ipc.ipc.Client'> 

Calling get_all()... 

Ping failed: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9e015a0610>: Failed to establish a new connection: [Errno 111] Connection refused'))

ago in openLCA by (120 points)

Please log in or register to answer this question.

...