Giter Club home page Giter Club logo

Comments (7)

amjith avatar amjith commented on September 27, 2024 1

Can you try this branch and tell me if it work?

pip install -U https://github.com/dbcli/litecli/archive/refs/heads/optional-config.zip

from litecli.

amjith avatar amjith commented on September 27, 2024

Litecli writes the default config file to ~/.config/litecli/config and it also uses that location to store the log files.

Can you try copying the liteclirc file into a location and launch litecli using:

litecli --liteclirc <PATH-TO-RC>

and see if that works?

from litecli.

ncrmro avatar ncrmro commented on September 27, 2024

@amjith same issue when

litecli --liteclirc /database/liteclirc

Traceback (most recent call last):
  File "/usr/local/bin/litecli", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/main.py", line 921, in cli
    litecli = LiteCli(
              ^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/main.py", line 123, in __init__
    self.initialize_logging()
  File "/usr/local/lib/python3.11/dist-packages/litecli/main.py", line 242, in initialize_logging
    ensure_dir_exists(log_file)
  File "/usr/local/lib/python3.11/dist-packages/litecli/config.py", line 30, in ensure_dir_exists
    os.makedirs(parent_dir)
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/nonexistent'

from litecli.

amjith avatar amjith commented on September 27, 2024

Can you try editing the log file location in your literc file?

https://github.com/dbcli/litecli/blob/main/litecli/liteclirc#L19

Set it to a location that is available in the docker container and see if that gets around it?

from litecli.

ncrmro avatar ncrmro commented on September 27, 2024

After creating the default, this ends up giving me.

nextjs@f095bfc4d0fe:/app$ litecli --liteclirc /tmp/liteclirc --logfile /tmp/txt.log
Traceback (most recent call last):
  File "/usr/local/bin/litecli", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/main.py", line 921, in cli
    litecli = LiteCli(
              ^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/main.py", line 78, in __init__
    c = self.config = get_config(liteclirc)
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/config.py", line 62, in get_config
    return load_config(liteclirc_file, default_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/litecli/config.py", line 21, in load_config
    cfg.merge(ConfigObj(expanduser(usr_cfg), interpolation=False, encoding="utf-8"))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/configobj/__init__.py", line 1229, in __init__
    self._load(infile, configspec)
  File "/usr/local/lib/python3.11/dist-packages/configobj/__init__.py", line 1318, in _load
    raise error
configobj.ConfigObjError: Parsing failed with several errors.
First error at line 129.
nextjs@f095bfc4d0fe:/app$ 

from litecli.

amjith avatar amjith commented on September 27, 2024

You're right that it shouldn't crash when it can't create the necessary folders. It'll be nice to print a warning that it failed to create them when the app starts so the user is aware.

If you're interested in contributing a PR, I'll be happy to merge it. If not, I'll take some time this upcoming week to implement it. Let me know what you prefer.

from litecli.

ncrmro avatar ncrmro commented on September 27, 2024

@amjith I can confirm this works ty!!!

from litecli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.