opencultureconsulting / openrefine-client

The OpenRefine Python Client from Paul Makepeace provides a library for communicating with an OpenRefine server. This fork extends the command line interface (CLI) and is distributed as a convenient one-file-executable (Windows, Linux, Mac). It is also available via Docker Hub, PyPI and Binder.
GNU General Public License v3.0
83 stars 19 forks source link

Connection refused #22

Open ncarboni opened 2 years ago

ncarboni commented 2 years ago

I am trying to use openrefine client on my local refine instance (OR 3.5.2 on M1 Mac) to get a list of all the projects. However, the command

docker run --rm --platform linux/amd64 --network=host -v ${PWD}:/data:z felixlohmeier/openrefine-client:v0.3.10 --list

result in the following error:

Traceback (most recent call last):
  File "/app/refine.py", line 35, in <module>
    __main__.main()
  File "/app/google/refine/__main__.py", line 237, in main
    cli.ls()
  File "/app/google/refine/cli.py", line 211, in ls
    projects = refine.Refine(refine.RefineServer()).list_projects().items()
  File "/app/google/refine/refine.py", line 154, in list_projects
    return self.server.urlopen_json('get-all-project-metadata')['projects']
  File "/app/google/refine/refine.py", line 114, in urlopen_json
    response = json.loads(self.urlopen(*args, **kwargs).read())
  File "/app/google/refine/refine.py", line 104, in urlopen
    (e.reason, self.server))
urllib2.URLError: <urlopen error [Errno 111] Connection refused for http://127.0.0.1:3333. No Refine server reachable/running; ENV set?>

Important to notice:

  1. Openrefine is running and it is functional!
  2. If I use the command with an instance of OpenRefine running on a server, everything works fine.

Any ideas?

felixlohmeier commented 2 years ago

Hi @ncarboni,

Unfortunately, I do not have a macOS test device. Maybe it's the network configuration of docker? The parameter --network=host seems to be Linux only:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

https://docs.docker.com/network/host/

ncarboni commented 2 years ago

Unfortunately, with or without host does not make a difference. If I find a solution I will post it here 👍

antoine2711 commented 2 years ago

I am trying to use openrefine client on my local refine instance (OR 3.5.2 on M1 Mac) to get a list of all the projects. However, the command

docker run --rm --platform linux/amd64 --network=host -v ${PWD}:/data:z felixlohmeier/openrefine-client:v0.3.10 --list

result in the following error: (…)

@ncarboni & @felixlohmeier: I found that this will work on a Macintosh…

docker run felixlohmeier/openrefine-client:v0.3.10 -H host.docker.internal -P 3333 --list

Regards, Antoine

ncarboni commented 2 years ago

Thank you! Unfortunately I still get an error

Traceback (most recent call last):
  File "/app/refine.py", line 35, in <module>
    __main__.main()
  File "/app/google/refine/__main__.py", line 237, in main
    cli.ls()
  File "/app/google/refine/cli.py", line 211, in ls
    projects = refine.Refine(refine.RefineServer()).list_projects().items()
  File "/app/google/refine/refine.py", line 154, in list_projects
    return self.server.urlopen_json('get-all-project-metadata')['projects']
  File "/app/google/refine/refine.py", line 114, in urlopen_json
    response = json.loads(self.urlopen(*args, **kwargs).read())
  File "/app/google/refine/refine.py", line 100, in urlopen
    raise Exception('HTTP %d "%s" for %s\n\t%s' % (e.code, e.msg, e.geturl(), data))
Exception: HTTP 404 "Not Found" for http://host.docker.internal:3333/command/core/get-all-project-metadata
    {}

At this point is quite clear that is me. I will try to maybe find a solution using another platform

antoine2711 commented 2 years ago

At this point is quite clear that is me. I will try to maybe find a solution using another platform

Hum. Maybe. This is what I get with the server running, and with the server closed. You get a 404, when I get a « No Refine server reachable/running; ENV set? ».

Weird.

Good luck, Antoine

Mac-Mini-AB-2019-i7:cypress antoine$ docker run felixlohmeier/openrefine-client:v0.3.10 -H host.docker.internal -P 3333 --list
 2576376891252: Verify facets panel (left-panel) appears with no facets yet-1655530987664
 1706530357456: TEST-One
Mac-Mini-AB-2019-i7:cypress antoine$ docker run felixlohmeier/openrefine-client:v0.3.10 -H host.docker.internal -P 3333 --list
Traceback (most recent call last):
  File "/app/refine.py", line 35, in <module>
    __main__.main()
  File "/app/google/refine/__main__.py", line 237, in main
    cli.ls()
  File "/app/google/refine/cli.py", line 211, in ls
    projects = refine.Refine(refine.RefineServer()).list_projects().items()
  File "/app/google/refine/refine.py", line 154, in list_projects
    return self.server.urlopen_json('get-all-project-metadata')['projects']
  File "/app/google/refine/refine.py", line 114, in urlopen_json
    response = json.loads(self.urlopen(*args, **kwargs).read())
  File "/app/google/refine/refine.py", line 104, in urlopen
    (e.reason, self.server))
urllib2.URLError: <urlopen error [Errno 111] Connection refused for http://host.docker.internal:3333. No Refine server reachable/running; ENV set?>