kdheepak / Notcurses.jl

MIT License
5 stars 0 forks source link

Can not initialize NotcursesObject when using contour #2

Open Yaraslaut opened 1 year ago

Yaraslaut commented 1 year ago

Can not initialize NotcursesObject when using contour

command to reproduce julia -e "import Notcurses; Notcurses.NotcursesObject()"

Stacktrace:
 [1] init
   @ Notcurses ~/.julia/packages/Notcurses/rn9fC/src/api.jl:12 [inlined]
 [2] #NotcursesObject#3
   @ Notcurses ~/.julia/packages/Notcurses/rn9fC/src/structs.jl:21 [inlined]
 [3] Notcurses.NotcursesObject()
   @ Notcurses ~/.julia/packages/Notcurses/rn9fC/src/structs.jl:20
 [4] top-level scope
   @ none:1
kdheepak commented 1 year ago

On MacOSX, I'm not getting any error:

image

You'll notice that NotcursesObject() calls this function:

https://github.com/kdheepak/Notcurses.jl/blob/132a9b4dded80bde1b61946b35124c51af876e19/src/structs.jl#L15-L23

which calls this function:

https://github.com/kdheepak/Notcurses.jl/blob/132a9b4dded80bde1b61946b35124c51af876e19/src/api.jl#L2-L19

Line 12 is checking that the pointer is not a C_NULL. The pointer is from this function:

https://github.com/kdheepak/Notcurses.jl/blob/132a9b4dded80bde1b61946b35124c51af876e19/src/lib/LibNotcurses_init.jl#L22-L38

which calls into the Notcurses C library.

To me this seems like the Notcurses library is returning an C_NULL in your terminal for some reason.

Things to check:

  1. Try it outside contour. Do you get the same error on a different terminal?
  2. What is your OS?
  3. Can you try it in Python? If you know how to use ctypes, you can even use the same library Julia does. And if you can get the same error in Python that makes it might more likely that the error is with the Notcurses library.

Lastly, depending on what you are interested in developing, I'd ask you to consider using TerminalUserInterfaces.jl or the underlying package Crossterm.jl. I'm the maintainer of those two packages and I'm happy to answer any questions regarding them.

Yaraslaut commented 1 year ago

Sorry for taking so long.

  1. I checked and this is not contour specific since on alacritty I seel same issue.
  2. This is happening on arch
  3. I will try to :)

Thanks for the references will definitely look into it. Also, here is notcurses-info image

kdheepak commented 1 year ago

Interesting that notcurses-info works. If you can try it in Python that’ll tell us if the issue is with Julia or the notcurses library compiled and distributed with the Julia package.