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

logics CLI not working when installed from PyPI #22

Open
sveneberth opened this issue Jan 17, 2023 · 2 comments
Open

logics CLI not working when installed from PyPI #22

sveneberth opened this issue Jan 17, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed logics-py question Further information is requested

Comments

@sveneberth
Copy link
Member

sveneberth commented Jan 17, 2023

I installed logics

$ python -m pip install logics-py -U
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: logics-py in /home/sven/.local/lib/python3.10/site-packages (0.0.3)

and tried to run the CLI

$ python -m logics
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/sven/.local/lib/python3.10/site-packages/logics/__main__.py", line 2, in <module>
    from logics import Logics
ImportError: cannot import name 'Logics' from 'logics' (unknown location)

But this failed. How can I test expression?

@sveneberth sveneberth added help wanted Extra attention is needed question Further information is requested labels Jan 17, 2023
@phorward
Copy link
Member

Hello @sveneberth, thanks for filing the issue.

Logics is currently beneath an entire rewrite. Therefore, logics-js, the JavaScript version, is currently working; logics-py the Python version, is right now in a very early stage, and only supports execution of simple expressions. I'll take a look at your issue soon.

The easiest way to get it currently running is, to clone the repository and do

~/logics $ cd logics-py/
~/logics/logics-py $ python -m logics -h
usage: __main__.py [-h] [-v var value] [-V] expression

Logics

positional arguments:
  expression            Expression to be parsed and executed

options:
  -h, --help            show this help message and exit
  -v var value, --var var value
                        Assign variables
  -V, --version         show program's version number and exit
~/logics/logics-py $ python -m logics 1+2*3+4
add
 add
  Number (1)
  mul
   Number (2)
   Number (3)
 Number (4)
11

@phorward phorward added the bug Something isn't working label Jan 17, 2023
@phorward phorward changed the title How to use the CLI parser? logics CLI not working when installed from PyPI Jan 17, 2023
@sveneberth
Copy link
Member Author

Hey @phorward, thanks for your quick response.

I had already checked out the repo. But only tried to run the __main__ directly. But that failed as well:

python __main__.py
$ python __main__.py 
Traceback (most recent call last):
  File "/.../logics/logics-py/logics/__main__.py", line 2, in <module>
    from logics import Logics
  File "/.../logics/logics-py/logics/logics.py", line 5, in <module>
    from .parser import LogicsParser
ImportError: attempted relative import with no known parent package

I didn't get the idea to run it as a module. That was the trick. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed logics-py question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants