GetRD / academic-file-converter

📚 Import Bibtex publications and Jupyter Notebook blog posts into your Markdown website or book. 将Bibtex转换为Markdown网站

Home Page:https://docs.hugoblox.com/reference/content-types/#automatically-import-publications-from-bibtex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when checking for hugo in docker

opened this issue · comments

I'm trying to use Academic to import my publications from a bibtex file but it turns out that the latest addition to check for a docker file breaks the script for me.

I get the following error:

ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\Scripts\academic-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\ProgramData\Miniconda3\lib\site-packages\academic\cli.py", line 43, in main
    parse_args(sys.argv[1:])  # Strip command name, leave just args.
  File "C:\ProgramData\Miniconda3\lib\site-packages\academic\cli.py", line 101, in parse_args
    import_bibtex(
  File "C:\ProgramData\Miniconda3\lib\site-packages\academic\import_bibtex.py", line 55, in import_bibtex
    parse_bibtex_entry(
  File "C:\ProgramData\Miniconda3\lib\site-packages\academic\import_bibtex.py", line 100, in parse_bibtex_entry
    page.load("index.md")
  File "C:\ProgramData\Miniconda3\lib\site-packages\academic\editFM.py", line 23, in load
    file = open(self.path, "r").readlines()
FileNotFoundError: [Errno 2] No such file or directory: 'content\\publication\\hill-life-2020\\index.md'

I am using Miniconda as my Python environment and I do have Docker installed and running in the background, but I do not have a docker-compose.yml file in the current directory that I am working in. I am running on Windows 10.

Commenting out the lines 8 - 11 in the function hugo_in_docker_or_local() in utils.py and just leaving hugo = "" allows the script to work for me.

commented

Thanks for reporting this.

The bug appears to be related to #68 - perhaps you and/or @ionlights can submit a PR to fix?

Does arichardson@ff11308 fix this issue? I saw similar problems.

@arichardson Sorry about that! 😅 I guess I glossed over that when I was making my PR. That ought to fix it. It's supposed to fall back to a regular hugo command if no docker-compose.yml is present.

commented

Thanks all :)

Closing this issue as just merged the fix in #71 .

A v0.6.2 release has been published with this fix and the UTF-8 file writing fix (see Releases page).

Let me know if there are still any related issues and I'll reopen this thread.