jgo icon indicating copy to clipboard operation
jgo copied to clipboard

Certain arguments passed to main class break endpoint resolution

Open hanslovsky opened this issue 2 years ago • 1 comments

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 avatar Mar 01 '23 21:03 hanslovsky

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.

hanslovsky avatar Mar 02 '23 03:03 hanslovsky