Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Client hangs with no error message, potential alternative to build-essentials for windows #199

Open
invertednz opened this issue Jan 3, 2020 · 6 comments

Comments

@invertednz
Copy link

invertednz commented Jan 3, 2020

Currently the python client does not work for me it just hangs on attempting to parse a file.

I am only running the following:
client = bblfsh.BblfshClient("localhost:9432")
print("parsing")
ctx = client.parse("ast.py")

I realized it maybe because I haven't installed the required dependencies:

"Dependencies
You also will need a curl cli tool to dowload libuast, and a g++ for building libuast Python bindings. The command for Debian and derived distributions would be:

sudo apt install curl build-essential"

Is there a windows alternative for this?

Just as an FYI I get the following in the docker server log

time="2020-01-03T11:22:58.3367974Z" level=info msg="python-driver version: v2.10.3 (build: 2019-10-25T13:40:25Z)" id=01dxnj9snfwpjbr0yq8v7g0t0t language=python
time="2020-01-03T11:22:58.3413548Z" level=info msg="server listening in /tmp/rpc.sock (unix)" id=01dxnj9snfwpjbr0yq8v7g0t0t language=python
time="2020-01-03T11:22:59.2967131Z" level=info msg="new driver instance started bblfsh/python-driver:latest (01dxnj9snfwpjbr0yq8v7g0t0t)"
time="2020-01-03T11:22:59.3601263Z" level=info msg="request processed content 913 bytes" elapsed=1.3212179s filename=ast.py githash=5ca83c1f3e6f816ab3df6e5e4452fd8c4f85e6e7 language=python sha1=a011fd51d314e1e4e4a2fa3cc771a432e21760b1

@invertednz
Copy link
Author

I tried installing https://nuwen.net/mingw.html but still no error, the command just hangs with no output.

@invertednz invertednz changed the title Alternative to build-essentials for windwos Client hangs with no error message, potential alternative to build-essentials for windows Jan 3, 2020
@kuba--
Copy link
Member

kuba-- commented Jan 3, 2020

Have you installed python driver on bblfsh server?
Is (bblfshd) running locally or inside a docker container?

@invertednz
Copy link
Author

invertednz commented Jan 4, 2020

Hey Kuba,

I have the bblfshd running in a docker container.

And these are my drivers. If I try to update the python one it says this is already the latest.

PS C:\Users\james> docker exec -it bblfshd bblfshctl driver list
+------------+------------------------------------------+---------+--------+----------+----+--------+
| LANGUAGE | IMAGE | VERSION | STATUS | CREATED | GO | NATIVE |
+------------+------------------------------------------+---------+--------+----------+----+--------+
| python | docker://bblfsh/python-driver:latest | v2.10.3 | beta | 2 months | | |
| cpp | docker://bblfsh/cpp-driver:latest | v1.5.0 | beta | 3 months | | |
| java | docker://bblfsh/java-driver:latest | v2.7.5 | beta | 2 months | | |
| javascript | docker://bblfsh/javascript-driver:latest | v2.10.2 | beta | 2 months | | |
| bash | docker://bblfsh/bash-driver:latest | v2.7.2 | beta | 2 months | | |
| ruby | docker://bblfsh/ruby-driver:latest | v2.9.6 | beta | 2 months | | |
| go | docker://bblfsh/go-driver:latest | v2.7.3 | beta | 2 months | | |
| csharp | docker://bblfsh/csharp-driver:latest | v1.7.1 | beta | 2 months | | |
| php | docker://bblfsh/php-driver:latest | v2.8.3 | beta | 2 months | | |
+------------+------------------------------------------+---------+--------+----------+----+--------+
Response time 5.6423ms

@kuba--
Copy link
Member

kuba-- commented Jan 5, 2020

ok, could you give me your python file, so I'll try to reproduce it?

@invertednz
Copy link
Author

invertednz commented Jan 6, 2020

Sure, although it happens with every file that I've tried and I managed to get everything working with ubuntu, so I think it is the windows setup.

ast.py

import bblfsh

client = bblfsh.BblfshClient("localhost:9432")
print("parsing")
ctx = client.parse("ast.py")
print("printing ctx")
print(ctx)

I was wondering is it possible to query on a line number? And is it possible to go from a node up to the parent node? Or can you only iterate like -

ast = ctx.root
it = ast.iterate(bblfsh.TreeOrder.POSITION_ORDER)
for node in it:
    print(node)

@kuba--
Copy link
Member

kuba-- commented Jan 6, 2020

Ohh, ok - in my opinion it can't work well on windows (where bblfshd internally creates subcontainers with communicates over grpc on top of std. IO).

Regarding query -you can filter with xpath whatever you want, e.g. next(ctx.filter("boolean(//*[@startOffset or @endOffset])"))
Every position is a tuple (Type, Col, Line, Offset), so in theory it should be doable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants