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

sys.path is not set to include the cwd #2

Closed
ri0t opened this issue Feb 25, 2017 · 2 comments
Closed

sys.path is not set to include the cwd #2

ri0t opened this issue Feb 25, 2017 · 2 comments

Comments

@ri0t
Copy link

ri0t commented Feb 25, 2017

Thanks for fixing the string conversion bug. Now i bumped into another one that is probably 3.x specific.
EDIT: Nope, that also happens on 2.7!

I could build the binary now, but it couldn't import the render module:

ModuleNotFoundError: No module named 'render'

So, i searched a bit and i think it is related to the CWD not being in the current sys.path:
Stackoverflow about sys.path with pyimport

I tried adding it but failed because the _get_PyString_fromString function returns a bytes.
So i did it via

PyRun_SimpleString("sys.path.append('/home/riot/src/FantasyMapGenerator/build')");

and it was able to import ther render module.

Afterwards i ran into two problems:

  • 3.5 - "Error: function not in module dict"
  • 3.6 - couldn't import cairo, probably a cairo bug: ModuleNotFoundError: No module named 'cairo._cairo'

I'd rather not open tickets for those, as i don't know whats going on with 3.5 and i think the 3.6-one is not related to this project. Help would be appreciated ;)

@rlguy
Copy link
Owner

rlguy commented Feb 25, 2017

Hello ri0t,

Thank you very much for testing the program and letting me know what is going wrong. I am sorry you are running into these errors!

I have only been able to test the program using Python 2.7 and Python 3.2. I can't seem to get the embedded Python libraries to work correctly for 3.5 or 3.6 on my machine.

I have updated the repository to add the directory containing the Python rendering code to sys.path.

I have also updated _get_PyString_fromString to use PyUnicode_FromString method instead of PyBytes_FromString. I think this would be more correct, and maybe it will fix the "function not in module dict" error.

I am not sure what is causing the "ModuleNotFoundError: No module named 'cairo._cairo'" error for you. I have found that if I use a version of cairo that is build for a different of Python, I will get the same error. This happened when I used a cairo build for Python 2.7 in Python 3.2.

I hope this helps. Please let me know if the changes end up fixing any of these issues.

Best Regards,
Ryan

@ri0t
Copy link
Author

ri0t commented Feb 26, 2017

Totally works! Thanks a lot :) 🍸 🎉 🥇
Oh: and NIIIIIIICE bg

@ri0t ri0t closed this as completed Feb 26, 2017
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

2 participants