What I actually did.
I created in myLeoSettings
@string 'import-leo-user-libs-dir' node with path to dir where all of my
modules reside and
@data ''import-leo-user-libs-loader' node where loader code resides.
@data ''import-leo-user-libs-loader'
def import_leo_user_lib(*names):
i
tried. doesnt actually help.
functions can deal with g&c, methods not.
very strange that :-)
2020-11-27 23:06 GMT+03:00, tbp1...@gmail.com :
> Try including g and c in the exec environment -
>
> environment = {'c': c, 'g': g}
> exec(open(c.config.getString('lib-dir') + "/lib.py").read(), environme
Try including g and c in the exec environment -
environment = {'c': c, 'g': g}
exec(open(c.config.getString('lib-dir') + "/lib.py").read(), environment)
On Friday, November 27, 2020 at 2:04:12 PM UTC-5 gar wrote:
> I did simpler. In myLeoSettings I created a @string with path to the
> libfile
I did simpler. In myLeoSettings I created a @string with path to the
libfile (it can there be customized by OS/hostname)
In the command I just load the lib with:
exec(open(c.config.getString('lib-dir') + "/lib.py").read())
and it loads pretty well.
When I call any function from thay lib - it eve
You could also add your directories to the pythonpath by adding a .pth file
containing the path(s), possibly in your application's directory or in
site-packages.
On Friday, November 27, 2020 at 11:18:58 AM UTC-5 tbp1...@gmail.com wrote:
> You could put the packages into some standard location k
You could put the packages into some standard location known by Python,
like sitecustomize.
On Friday, November 27, 2020 at 10:33:25 AM UTC-5 gar wrote:
> yeah, just reinvented that right now.
> but actually I would love to avoid hardcoding the path
> but got no idea which location should be the
yeah, just reinvented that right now.
but actually I would love to avoid hardcoding the path
but got no idea which location should be the default one
пятница, 27 ноября 2020 г. в 18:26:07 UTC+3, tbp1...@gmail.com:
> Wouldn't this work, as long as you know the path already?
>
> import sys
> sys.p
Wouldn't this work, as long as you know the path already?
import sys
sys.path.insert(path_to_lib, 0)
import lib
This would cause Python to look first in path_to_lib for the import. I've
used this technique a few times myself.
On Friday, November 27, 2020 at 9:16:06 AM UTC-5 gar wrote:
> What I
What I've done by now.
In the very beginning of the command which wants to use my library's code I
write:
import importlib.util
spec = importlib.util.spec_from_file_location("module.name",
"")
ltools = importlib.util.module_from_spec(spec)
spec.loader.exec_module(ltools)
lib.init(c, g)
lib by i
here is what I need.
Say I am trying to build leo-based IDE for js/ts/lua/sql. I have a number
of common action like
'run selection in the external interpreter and place output to leo's tab'
'feed source file to some tool and replace content with output'
and so on.
They all are quite big pieces of
10 matches
Mail list logo