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

Can't evaluate python from Hy #20

Open
SqrtMinusOne opened this issue May 20, 2021 · 0 comments
Open

Can't evaluate python from Hy #20

SqrtMinusOne opened this issue May 20, 2021 · 0 comments

Comments

@SqrtMinusOne
Copy link

The following doesn't seem to work in calysto_hy:

(py "print('hello')")

Stacktrace:

Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: expected str, bytes or os.PathLike object, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/calysto_hy/kernel.py", line 143, in do_execute_direct
    _ast = hy_compile(tokens, '', root=ast.Interactive, compiler=self.compiler)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 2168, in hy_compile
    result = compiler.compile(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1968, in compile_list
    elts, ret, _ = self._compile_collect(expression)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 498, in _compile_collect
    ret += self.compile(expr)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 451, in compile
    reraise(HyCompileError, HyCompileError(exc_msg), sys.exc_info()[2])
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/_compat.py", line 13, in reraise
    raise value.with_traceback(traceback)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
hy.errors.HyCompileError: Internal Compiler Bug 😱
⤷ Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The following, however, does work:

(hy.eval '(py "print('hello')"))

Looks like a problem with the kernel rather than with my particular setup.

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