Comments (5)
accept filename as a command line argument
I guess that's really the essence of it, can't think of another requirement.
For starters, before modifying RPM, I'd try to write a wrapper that accepts a script as argument, and sets up your custom interpreter as needed.
from ilua.
The problem with debugging this is for me that even using this fails for me:
#/usr/bin/bash
exec /usr/bin/lua "$@"
$ ilua -i lua
Jupyter console 6.1.0
ILua 0.2.1
In [1]: print"a"
a
$ ilua -i luafake
Jupyter console 6.1.0
ILua 0.2.1
In [1]: print"a"2020-05-12T20:06:42+0200 [ilua.kernel.ILuaKernel#critical] Uncought exception in message handler
Traceback (most recent call last):
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python3.8/site-packages/ilua/kernelbase.py", line 196, in handle_message
content = yield self.do_is_complete(**msg['content'])
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
return _cancellableInlineCallbacks(gen)
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
_inlineCallbacks(None, g, status)
--- <exception caught here> ---
File "/usr/lib/python3.8/site-packages/ilua/kernelbase.py", line 196, in handle_message
content = yield self.do_is_complete(**msg['content'])
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python3.8/site-packages/ilua/kernel.py", line 179, in do_is_complete
result = yield self.proto.sendRequest({"type": "is_complete",
builtins.AttributeError: 'ILuaKernel' object has no attribute 'proto'
In [1]: print"a"
/usr/lib/python3.8/site-packages/jupyter_console/ptshell.py:656: UserWarning: The kernel did not respond to an is_complete_request. Setting `use_kernel_is_complete` to False.
warn('The kernel did not respond to an is_complete_request. '
2020-05-12T20:06:43+0200 [ilua.kernel.ILuaKernel#critical] Uncought exception in message handler
Traceback (most recent call last):
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python3.8/site-packages/ilua/kernelbase.py", line 193, in handle_message
content = yield self.do_execute(**msg['content'])
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
return _cancellableInlineCallbacks(gen)
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
_inlineCallbacks(None, g, status)
--- <exception caught here> ---
File "/usr/lib/python3.8/site-packages/ilua/kernelbase.py", line 193, in handle_message
content = yield self.do_execute(**msg['content'])
File "/usr/lib64/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python3.8/site-packages/ilua/kernel.py", line 126, in do_execute
result = yield self.proto.sendRequest({"type": "execute",
builtins.AttributeError: 'ILuaKernel' object has no attribute 'proto'
from ilua.
Hmm, same script worked on my machine. Perhaps you need to change 'luafake' to './luafake' or wherever it's placed.
Further more, you can get more verbose output with ilua -l debug
I'm sorry about that unfortunate stack trace. It really is incomprehensible
from ilua.
luafake is in PATH:
$ luafake
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
> print"a"
a
>
$ ilua -l debug -i luafake
2020-05-12T22:14:02+0200 [ilua.kernel.ILuaKernel#debug] Launching child lua
2020-05-12T22:14:02+0200 [ilua.proto.OutputCapture#debug] Process is running
2020-05-12T22:14:02+0200 [ilua.proto.OutputCapture#debug] Received stdout data: b'Upon execvpe luafake [b\'luafake\', b\'/usr/lib/python3.8/site-packages/ilua/interp.lua\'] in environment id 140414718368224\n:Traceback (most recent call last):\n File "/usr/lib64/python3.8/site-packages/twisted/internet/process.py", line 405, in _fork\n self._execChild(path, uid, gid, executable, args,\n File "/usr/lib64/python3.8/site-packages/twisted/internet/process.py", line 484, in _execChild\n os.execvpe(executable, args, environment)\n File "/usr/lib64/python3.8/os.py", line 577, in execvpe\n _execvpe(file, args, env)\n File "/usr/lib64/python3.8/os.py", line 609, in _execvpe\n raise saved_exc\n File "/usr/lib64/python3.8/os.py", line 601, in _execvpe\n exec_func(fullname, *argrest)\nOSError: [Errno 8] Exec format error\n'
Jupyter console 6.1.0
That is indeed more interesting:
Traceback (most recent call last):
File "/usr/lib64/python3.8/site-packages/twisted/internet/process.py", line 405, in _fork
self._execChild(path, uid, gid, executable, args,
File "/usr/lib64/python3.8/site-packages/twisted/internet/process.py", line 484, in _execChild
os.execvpe(executable, args, environment)
File "/usr/lib64/python3.8/os.py", line 577, in execvpe
_execvpe(file, args, env)
File "/usr/lib64/python3.8/os.py", line 609, in _execvpe
raise saved_exc
File "/usr/lib64/python3.8/os.py", line 601, in _execvpe
exec_func(fullname, *argrest)
OSError: [Errno 8] Exec format error
It's was just a typo in shebang :)
from ilua.
So far I'm blocked by rpm-software-management/rpm#1215
But this seem to do the trick:
#!/usr/bin/bash
exec rpm --eval '%{lua:package.path = "'${LUA_PATH}';" .. package.path;'"$(cat "$@")"';rpm.interactive()}'
Thanks.
EDIT: the rpm.interactive()
call is redundant, the executed file takes care of that
from ilua.
Related Issues (20)
- Ctrl-C Interrupt Support HOT 5
- Operation not permitted when piping in stdin HOT 2
- No such kernel named lua HOT 4
- RFE: A way to pass additional help_links from kernel.json HOT 3
- Install error on macOS HOT 4
- Installing to Jupyter's kernelspec? HOT 2
- Implement a backend running the kernel in the same process using lupa HOT 1
- Got error in jupyter lab HOT 19
- Exception 'coroutine' object is not subscriptable on typing anything HOT 11
- How to pip install ilua in specify lua version? HOT 4
- ilua in fedora 34 no docstrings, only ? HOT 1
- how to quit/close/exit ilua? HOT 2
- Exit cleanly when no Lua executable found HOT 1
- Tab-completion crashes HOT 7
- The included "inspect" module poorly respects __tostring metamethods
- builtins.AttributeError: 'ILuaKernel' object has no attribute 'proto' HOT 10
- Docstring crashing shell HOT 3
- printing HOT 7
- Passing ipython command line arguments HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ilua.