Giter Club home page Giter Club logo

Comments (5)

glensc avatar glensc commented on June 16, 2024 1

still float error. you probably need to test it yourself. probably you would know why it attempts to parse something as float.

also the quotes i have in some other example. i was just experimenting if the error changes

from tracboat.

nazavode avatar nazavode commented on June 16, 2024

I still need to properly test the usermap specification, anyway you could try this way:

# cat comment.toml
[tracboat]
# ... stuff
[tracboat.usermap]
glen = "glen"
foo = "bar"

There is also the possibility to specify multiple mappings via command line options:

tracboat migrate --mock --usermap glen glen --usermap foo bar

Please note that, as usual, command line options will override what is specified via configuration file, so:

tracboat --config-file=comment.toml migrate --mock --usermap glen glen --usermap foo FOOUSER

User foo is bar inside the file but the FOOUSER value will take precedence.

from tracboat.

glensc avatar glensc commented on June 16, 2024

getting same exception

# tracboat --config-file=comment.toml migrate --mock
Traceback (most recent call last):
  File "/home/glen/tracboat/VENV/bin/tracboat", line 9, in <module>
    load_entry_point('tracboat==0.2.0-alpha', 'console_scripts', 'tracboat')()
  File "/home/glen/tracboat/tracboat/cli.py", line 412, in main
    cli(obj={})
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 1063, in invoke
    Command.invoke(self, ctx)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/glen/tracboat/tracboat/cli.py", line 198, in cli
    conf = toml.load(config_file).get('tracboat', {})
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/toml.py", line 40, in load
    return loads(ffile.read(), _dict)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/toml.py", line 286, in loads
    ret = _load_line(line, currentlevel, multikey, multibackslash)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/toml.py", line 353, in _load_line
    value, vtype = _load_value(pair[1])
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/toml.py", line 508, in _load_value
    raise TomlDecodeError("This float doesn't have a leading digit")
toml.TomlDecodeError: This float doesn't have a leading digit
# cat comment-users.toml
[tracboat]
lammas = "123"

[tracboat.usermap]
glen = glen

and without specifying user map or user map file, get key error:

(VENV)root@soa:~/tracboat# tracboat --config-file=comment.toml migrate --mock
Traceback (most recent call last):
  File "/home/glen/tracboat/VENV/bin/tracboat", line 9, in <module>
    load_entry_point('tracboat==0.2.0-alpha', 'console_scripts', 'tracboat')()
  File "/home/glen/tracboat/tracboat/cli.py", line 412, in main
    cli(obj={})
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/glen/tracboat/tracboat/cli.py", line 115, in wrapper
    return func(*args, **kwargs)
  File "/home/glen/tracboat/tracboat/cli.py", line 171, in wrapper
    return func(*args, **kwargs)
  File "/home/glen/tracboat/VENV/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/glen/tracboat/tracboat/cli.py", line 352, in migrate
    umap.update(toml.load(config_file)['usermap'])
KeyError: 'usermap'

from tracboat.

nazavode avatar nazavode commented on June 16, 2024

You're right, I spotted an error on my side, I have to wait for this evening to fix it (I'm doing this in my spare time) but you could try to change the line cli.py:352 to:

umap.update(toml.load(config_file)['tracboat']['usermap'])

I'm sorry, I'm not 100% sure about this though, I have to try it first.

In the meantime I see one issue on your side, you should quote values (and not keys) in TOML:

# ...
[tracboat.usermap]
glen = "glen"

from tracboat.

nazavode avatar nazavode commented on June 16, 2024

@glensc give a look at #17, needs testing but it should be fairly complete.

from tracboat.

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.