Closed spookware closed 1 year ago
Hi @spookware can you post the Nim file? I think you might be missing exportpy
. Make sure to compare your code with the README since Nim code has to be annotated in order to be used by Python.
This is the code in the nim file:
import nimkov/[generator, objects, validators]
import nimpy
proc generate(file: File): auto =
var file = open("messages.txt")
let phrases = file.readAll().split("\n")
file.close()
let markov = newMarkov(phrases)
return markov.generate().get```
All functions you want to have exposed to Python need: {.exportpy.}
That should fix this error for you. Let me know if it doesn’t work.
I am trying to import my nim file to python. Recieving this output/error: