citronneur / rdpy

Remote Desktop Protocol in Twisted Python
GNU General Public License v3.0
1.67k stars 545 forks source link

Py_InitModule error (Py3.x support?) #83

Open jeybb opened 5 years ago

jeybb commented 5 years ago

Tested: Windows + Py3.6

Getting an error regarding Py_InitModule for RLC on build via pip install:

building 'rle' extension creating build\temp.win32-3.6 creating build\temp.win32-3.6\Release creating build\temp.win32-3.6\Release\ext ...... rle.c ext/rle.c(945): warning C4013: 'Py_InitModule' undefined; assuming extern returning int ...... LINK : error LNK2001: unresolved external symbol PyInit_rle build\temp.win32-3.6\Release\ext\rle.cp36-win32.lib : fatal error LNK1120: 1 unresolved externals error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe' failed with exit status 1120

Searched around and it looks like a Py2.x vs 3.x issue:

https://github.com/vyassu/DeepSentiment/issues/8

Thanks for your time!

warwolf767 commented 5 years ago

I was trying to modify ext/rle.c

PyMODINIT_FUNC initrle(void)
{
     (void) Py_InitModule("rle", rle_methods);
}

to

static struct PyModuleDef rle =
{
    PyModuleDef_HEAD_INIT,
    "rle", /* name of module */
    "",          /* module documentation, may be NULL */
    -1,          /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
    rle_methods
};

PyMODINIT_FUNC PyInit_rle(void)
{
     return PyModule_Create(&rle);
}

, and modify code/log.py print "[*] %s"%message to print("[*] %s"%message)

It can be successfully installed

kainarchai commented 3 years ago

Thank you, @warwolf767