Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain arguments passed to main class break endpoint resolution #92

Open
hanslovsky opened this issue Mar 1, 2023 · 1 comment
Open

Comments

@hanslovsky
Copy link
Member

I use jgo to start an image viewer. I added an option to fetch images via grpc and pass the grpc host via

grpc://<hostname>:<port>

to the main class. When I run the viewer on the command line with jgo, endpoint resolution breaks. This works with arbitrary endpoints, e.g. here I use org.scijava:parsington as example:
Works without `grpc://:

$ jgo org.scijava:parsington
> 

Breaks with `grpc://::

$ jgo org.scijava:parsington -- -d grpc://localhost:1234
INFO 2023-03-01 16:32:11,464: First time start-up may be slow. Downloaded dependencies will be cached for shorter start-up times in subsequent executions.
Traceback (most recent call last):
  File "/home/zottel/.local/bin/jgo", line 8, in <module>
    sys.exit(main())
  File "/home/zottel/.local/lib/python3.10/site-packages/jgo/jgo.py", line 404, in _jgo_main
    completed_process = run(parser, argv=argv, stdout=stdout, stderr=stderr)
  File "/home/zottel/.local/lib/python3.10/site-packages/jgo/jgo.py", line 781, in run
    primary_endpoint, workspace = resolve_dependencies(
  File "/home/zottel/.local/lib/python3.10/site-packages/jgo/jgo.py", line 577, in resolve_dependencies
    os.makedirs(workspace, exist_ok=True)
  File "/usr/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '//localhost'

Notes

  1. I tried adding -- to distinguish between jgo and main class arguments. Same effect with or without --
  2. I see this behavior with 1.0.5 and current main
@hanslovsky
Copy link
Member Author

I have a solution in #93 but I also have a workaround for CLI that have both long and short option:

$ jgo org.scijava:parsington --dataset=grpc://localhost:1234
Exception in thread "main" java.util.NoSuchElementException
        at java.util.LinkedList.removeLast(LinkedList.java:283)
        at org.scijava.parsington.SyntaxTree.<init>(SyntaxTree.java:56)
        at org.scijava.parsington.SyntaxTree.<init>(SyntaxTree.java:63)
        at org.scijava.parsington.ExpressionParser.parseTree(ExpressionParser.java:139)
        at org.scijava.parsington.eval.TreeEvaluator.evaluate(TreeEvaluator.java:61)
        at org.scijava.parsington.Main.main(Main.java:57)

(The Java exception is expected because the supplied argument does not make any sense for parsington)
Note: It is important to add the = between the long option and the value for this workaround to work.

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

No branches or pull requests

1 participant