Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‘PyString_FromString’ was not declared in this scope #1

Closed
ahopkins opened this issue Jan 17, 2017 · 3 comments
Closed

‘PyString_FromString’ was not declared in this scope #1

ahopkins opened this issue Jan 17, 2017 · 3 comments

Comments

@ahopkins
Copy link

I was trying to install your package, but when running make I encountered the following.

/my/path/FantasyMapGenerator/src/render.cpp: In function ‘void gen::render::drawMap(std::vector<char>&, std::__cxx11::string)’:
/my/path/FantasyMapGenerator/src/render.cpp:17:75: error: ‘PyString_FromString’ was not declared in this scope
     PyObject *pFunctionName = PyString_FromString(drawFunctionName.c_str());
                                                                           ^
CMakeFiles/objects.dir/build.make:254: recipe for target 'CMakeFiles/objects.dir/src/render.cpp.o' failed
make[2]: *** [CMakeFiles/objects.dir/src/render.cpp.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/objects.dir/all' failed
make[1]: *** [CMakeFiles/objects.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Any thoughts on resolving?

@ahopkins
Copy link
Author

Issue resolved. I ran it inside a virtual environment with python 3 instead of legacy python, and all is well.

@ri0t
Copy link

ri0t commented Feb 23, 2017

I don't think this resolves the issue (yeah, i'm a hard-switch-to-3 advocate), but i'm also not exactly proficient in what exactly is going awry here. I am missing a (cmake?) argument to make sure which interpreter is used.
The system chose 3.6 here by default (without any venv, running it within a 2.7 venv doesn't help!) - so either the code should work with that or the default selection is bad and should've announce the problem :)

@rlguy
Copy link
Owner

rlguy commented Feb 23, 2017

I have looked into this. I have found that in Python3, the PyString_FromString method was updated to PyBytes_FromString. In Python3.2+ the PyString_FromString method was removed. I have updated the repository to choose the correct method depending on which Python interpreter CMake selects.

I hope this resolves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants