d2l-book icon indicating copy to clipboard operation
d2l-book copied to clipboard

d2lbook create fails to initialize a new book

Open mohamed-ali opened this issue 5 years ago • 1 comments

I am using python 3.7 with d2lbook 0.1.9.

$ python --version 
Python 3.7.2
$ pip freeze |grep d2lbook 
d2lbook==0.1.9

When I try to initialize a new project with the two example commands in the documentation, I get the following error message:

$ d2lbook create mybook

Error:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1034, in emit
    msg = self.format(record)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 880, in format
    return fmt.format(record)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 619, in format
    record.message = record.getMessage()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 380, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/Users/SomeUser/Desktop/workspace/books/bin/d2lbook", line 10, in <module>
    sys.exit(main())
  File "/Users/SomeUser/Desktop/workspace/books/lib/python3.7/site-packages/d2lbook/main.py", line 17, in main
    config = Config('config.ini')
  File "/Users/SomeUser/Desktop/workspace/books/lib/python3.7/site-packages/d2lbook/config.py", line 8, in __init__
    logging.fatal('Failed to find the config', config_fname)
Message: 'Failed to find the config'
Arguments: ('config.ini',)
[d2lbook:config.py:L9] CRITICAL You can use "d2lbook create ." to create a default config
$ d2lbook create mybook --demo
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1034, in emit
    msg = self.format(record)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 880, in format
    return fmt.format(record)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 619, in format
    record.message = record.getMessage()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 380, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/Users/SomeUser/Desktop/workspace/books/bin/d2lbook", line 10, in <module>
    sys.exit(main())
  File "/Users/SomeUser/Desktop/workspace/books/lib/python3.7/site-packages/d2lbook/main.py", line 17, in main
    config = Config('config.ini')
  File "/Users/SomeUser/Desktop/workspace/books/lib/python3.7/site-packages/d2lbook/config.py", line 8, in __init__
    logging.fatal('Failed to find the config', config_fname)
Message: 'Failed to find the config'
Arguments: ('config.ini',)
[d2lbook:config.py:L9] CRITICAL You can use "d2lbook create ." to create a default config

My assumption is that if the config.ini doesn't exist it will be created automatically.

@mli Do you know how to fix this? Thanks.

mohamed-ali avatar Jul 26 '19 12:07 mohamed-ali

Thanks for pointing it out. That's a missing feature.. We need to put the files in the demo/ folder into the pypi package. But I don't have a plan to fix it right now. It'll be wonder if you could contribute it:)

mli avatar Jul 27 '19 20:07 mli