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

Using davidjo/UnrealEnginePython on Linux, python 3.8 and Unreal 4.25.3 crashes when loading UnrealEnginePython plugin #861

Open
hradec opened this issue Sep 24, 2020 · 7 comments

Comments

@hradec
Copy link

hradec commented Sep 24, 2020

So, I got davidjo/UnrealEnginePython to build successfully on Arch Linux, python 3.8 and Unreal 4.25.3. It does build without problem, but when Unreal tries to load the plugin, it crashes on line UnrealEnginePython/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp:529.

Examining the source, the crash is because the code tries to retrieve the dictionary of a module, but the module pointer is empty.
By examining the log, right before the crash, I've found this:

[2020.09.24-21.41.38:492][  0]LogPython: Python Scripts search path: .
[2020.09.24-21.41.38:492][  0]LogPython: Python Scripts search path: ???
[2020.09.24-21.41.38:492][  0]LogPython: Python VM initialized: 3.8.0 (default, Oct 23 2019, 18:51:26) 

It does seem like python search path is empty, which would explain why it can't load the module and the pointer returns empty.
I've tried to booth unset PYTHONPATH (hoping the python vm would use the default one) and setting to the proper search path, but no matter what I do with PYTHONPATH, the message above never changes. (actually, the ??? changes to some other garbage, which probably means it's displaying an uninitialized string?!)

Anyhow... if someone knows what the problem is, I would appreciate the help! I'll start digging in the code to trace what's going on.

@hradec hradec changed the title Using davidjo/UnrealEnginePython on Linux, python 3.8 and Unreal 4.25.3 seems to crash when loading UnrealEnginePython plugin Using davidjo/UnrealEnginePython on Linux, python 3.8 and Unreal 4.25.3 crashes when loading UnrealEnginePython plugin Sep 25, 2020
@hradec
Copy link
Author

hradec commented Sep 26, 2020

Just an update.

I was able to build using Python 2.7.12, after removing -Werror from LinuxToolChain.cs and setting

[/Script/LinuxTargetPlatform.LinuxTargetSettings]
TargetArchitecture=X86_64UnknownLinuxGnu

into Config/DefaultEngine.ini. (Building with python 2.7.x generates a lot of no-harmful warnings and having -Werror prevents it from building)

With python 2.7.x davidjo/UnrealEnginePython plugin seems to work just fine in Unreal 4.25.3 on Linux. The Python Scripts search path: ??? still shows, but doesn't crash on UnrealEnginePython.cpp line 529.

I'll stop debugging with python 3.8 for now, since I do prefer to use python 2.7 anyways... But it does seem to have something going on when building with 3.8.

@i-am-nut
Copy link

i-am-nut commented Sep 28, 2020

It's nice! I think nobody else has managed to do it.

I'm just a dude wandering around here wondering if this project is totally abandoned or not.

Are you being able to use this plugin without little issues? like editor crash, running succesfully doc examples and whatnot?

@hradec
Copy link
Author

hradec commented Sep 28, 2020 via email

@i-am-nut
Copy link

i-am-nut commented Sep 29, 2020

In case of applying the same modifications for working on Windows version, what would be the steps?

@hradec
Copy link
Author

hradec commented Sep 29, 2020 via email

@davidjo
Copy link

davidjo commented Oct 15, 2020

The following patch fixes the Python Scripts search path print and hopefully fixes the python 3 crash.
(Although for me on Ubuntu 20.04 LTS using system python 3.8 and UE 4.25.3 I dont get a crash - but do get bad log of Python Scripts search path: . twice)

UnrealEnginePython.cpp.patch.txt

@davidjo
Copy link

davidjo commented Oct 16, 2020

So I now dont think the issue is the bad Python Scripts search path prints - they have been bad since for a while (last correct print I have is late 2017 UE 4.18 python 3.6) - for me the bad prints are from 4.21 and python 3.6 - and it appears to be a pure printing error - the value is saved correctly.

The following patch corrects the print error.
UnrealEnginePython.cpp.patch.txt

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