pietroppeter/nimib

JsonParsingError when run

Closed this issue · 22 comments

  • code
import nimib

nbInit

nbCode:
  echo "hello nim"

nbSave
  • error log
[nimib] using default config
[nimib] srcDir: /mnt/e/code/me/test-nim
[nimib] filename: ./test.html
[nimib] setting current directory to nb.homeDir: /mnt/e/code/me/test-nim
/mnt/e/code/me/test-nim/test.nim(3) test
/root/.local/share/mise/installs/nim/2.0.2/nimble/pkgs2/nimib-0.3.9-aef1ca56d3e8ab84e7c34f5122d3e9f9bc39a8bf/n
imib/themes.nim(139) useDefault
/root/.local/share/mise/installs/nim/2.0.2/nimble/pkgs2/nimib-0.3.9-aef1ca56d3e8ab84e7c34f5122d3e9f9bc39a8bf/n
imib/config.nim(11) getNimibVersion
/root/.local/share/mise/installs/nim/2.0.2/lib/pure/json.nim(1040) parseJson
/root/.local/share/mise/installs/nim/2.0.2/lib/pure/json.nim(956) parseJson
/root/.local/share/mise/installs/nim/2.0.2/lib/pure/json.nim(921) parseJson
/root/.local/share/mise/installs/nim/2.0.2/lib/pure/parsejson.nim(518) raiseParseErr
Error: unhandled exception: input(1, 10) Error: { expected [JsonParsingError]

I can't reproduce this error locally 🤔 Which version of nimble do you have?

I can't reproduce this error locally 🤔 Which version of nimble do you have?

nimble v0.14.2 compiled at 2023-12-15 01:05:41

Strange, me too :o

From your error message, it seems like we both have nimib 0.3.9 and Nim 2.0.2

Could you edit the file /root/.local/share/mise/installs/nim/2.0.2/nimble/pkgs2/nimib-0.3.9-aef1ca56d3e8ab84e7c34f5122d3e9f9bc39a8bf/nimib/config.nim and modify it to print the variable dumpedJson?

let dumpedJson = execProcess("nimble dump --json", dir) # line 9
echo "DUMPED JSON: ", dumpedJson # add this line

/root/.local/share/mise/installs/nim/2.0.2/nimble/pkgs2/nimib-0.3.9-aef1ca56d3e8ab84e7c34f5122d3e9f9bc39a8bf/nimib/config.nim

{
  "name": "nimib",
  "version": "0.3.9",
  "author": "Pietro Peterlongo & Hugo Granström",
  "desc": "nimib 🐳 - nim 👑 driven ⛵ publishing ✍",
  "license": "MIT",
  "skipDirs": [],
  "skipFiles": [],
  "skipExt": [],
  "installDirs": [],
  "installFiles": [],
  "installExt": [],
  "requires": [
    {
      "name": "nim",
      "str": ">= 1.4.0",
      "ver": {
        "kind": "verEqLater",
        "ver": "1.4.0"
      }
    },
    {
      "name": "tempfile",
      "str": ">= 0.1.6",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.1.6"
      }
    },
    {
      "name": "markdown",
      "str": ">= 0.8.1",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.8.1"
      }
    },
    {
      "name": "mustache",
      "str": ">= 0.2.1",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.2.1"
      }
    },
    {
      "name": "parsetoml",
      "str": ">= 0.7.0",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.7.0"
      }
    },
    {
      "name": "jsony",
      "str": ">= 1.1.5",
      "ver": {
        "kind": "verEqLater",
        "ver": "1.1.5"
      }
    }
  ],
  "bin": [],
  "binDir": "",
  "srcDir": "src",
  "backend": "c"
}

Thanks :D That looks exactly as it should...

I'm at a loss what the problem could be sadly :/

I'm at a loss what the problem could be sadly :/

My problem I'm loss something

completed version:

DUMPED JSON:       Info: Using the environment variable: NIMBLE_DIR='/root/.local/share/mise/installs/nim/2.0.
2/nimble'
{
  "name": "nimib",
  "version": "0.3.9",
  "author": "Pietro Peterlongo & Hugo Granström",
  "desc": "nimib 🐳 - nim 👑 driven ⛵ publishing ✍",
  "license": "MIT",
  "skipDirs": [],
  "skipFiles": [],
  "skipExt": [],
  "installDirs": [],
  "installFiles": [],
  "installExt": [],
  "requires": [
    {
      "name": "nim",
      "str": ">= 1.4.0",
      "ver": {
        "kind": "verEqLater",
        "ver": "1.4.0"
      }
    },
    {
      "name": "tempfile",
      "str": ">= 0.1.6",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.1.6"
      }
    },
    {
      "name": "markdown",
      "str": ">= 0.8.1",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.8.1"
      }
    },
    {
      "name": "mustache",
      "str": ">= 0.2.1",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.2.1"
      }
    },
    {
      "name": "parsetoml",
      "str": ">= 0.7.0",
      "ver": {
        "kind": "verEqLater",
        "ver": "0.7.0"
      }
    },
    {
      "name": "jsony",
      "str": ">= 1.1.5",
      "ver": {
        "kind": "verEqLater",
        "ver": "1.1.5"
      }
    }
  ],
  "bin": [],
  "binDir": "",
  "srcDir": "src",
  "backend": "c"
}

That's problematic. I don't have NIMBLE_DIR defined, so that's why I don't get the error. The question then is how we can suppress that message / filter it out

That's problematic. I don't have NIMBLE_DIR defined, so that's why I don't get the error. The question then is how we can suppress that message / filter it out

i add --silent, and work now

      --silent                    Hide all Nimble and Nim output

I can't seem to find any way to suppress it. Nimble automatically supresses warning but not Info when running dump :/. So I guess we have to filter it out then. Will have to think through this a bit to decide on which approach is the best.

nimble dump --silent --json

Oh that's fantastic 🥳

WOuld you like to make a PR with this fix? :D

WOuld you like to make a PR with this fix? :D

I'm not very familiar with this project,thanks ;-)

It's not very complicated, you have already done the hard part, solving the bug. All you have to do is:

  1. Fork the repo
  2. Clone your fork
  3. Make the edit you just made locally
  4. Push the code to your fork
  5. Open a PR

That's all you need to know :D

😉make PR here: #230

Awesome, thank you! 🤩 Once the tests have passed I will merge it and release a new version later today

You should now be able to install nimib 0.3.10 and get your fix included :D Thanks again

Thanks for working on this! indeed it was a known issue #216