Open alanjds opened 6 years ago
google/grumpy#14 opened by @teodor-pripoae on 4 Jan 2017
I'm trying to implement a simple HTTP server, but it seems I can't send a python function as a go function to HandleFunc.
from __go__.net.http import ListenAndServe from __go__.githubcom.gorilla.mux import NewRouter from __go__.fmt import Fprintf def HomeHandler(w, r): Fprintf(w, "Hello world") r = NewRouter() r.HandleFunc("/", HomeHandler) ListenAndServe(":8000", r)
I'm receiving this error:
$ cat web.py | make run TypeError: cannot convert grumpy.Object to func(http.ResponseWriter, *http.Request) exit status 1 make: *** [run] Error 1
Comment by trotterdylan Wednesday Jan 04, 2017 at 21:08 GMT
Yeah, this used to work but I think it got removed as part of some other refactoring. I'll spend some time getting it working again.
Comment by S-YOU Thursday Jan 05, 2017 at 07:42 GMT
I think the real issue is how to convert something(w, r) from python to func(http.ResponseWriter, *http.Request), you might need type annotations like python 3.6 does.
google/grumpy#14 opened by @teodor-pripoae on 4 Jan 2017
I'm trying to implement a simple HTTP server, but it seems I can't send a python function as a go function to HandleFunc.
I'm receiving this error: