Download

Python scripting plugin doesn't work

I’ve been trying to enable the plugin as described in Scripting the Editor using Python | Unreal Engine Documentation, but without success.

I enabled Python Editor Script Plugin and Editor Scripting Utilities in the plugins menu and restarted the editor, but it seems to have no effect. I don’t get any new options in the File menu, the dropdown in the output log only shows the cmd option, and the py command does nothing.

The output log has the line “LogPluginManager: Mounting plugin PythonScriptPlugin”, so apparently the plugin is being loaded. There are no error messages as far as I can tell.

I’m using UE 4.21 on macOS Sierra.

Can anybody help?

I also have the same issue. I am also using unreal engine 4.21 in LInux Ubuntu. I too have enabled all the plugins required for python and restrated my python. But I cannot see any python option in my output log other than cmd. Can anybody please provide a solution

Windows is currently the only supported platform for builds installed from the launcher, however a source build of a Mac editor (when you have Python installed in a location we can find) will work. We’re currently aiming to have Python working out-of-the-box on Mac for 4.22.

Have same issue on Windows box. Intel NUC NUC8I7HVK Mini PC/HTPC, Intel Quad-Core i7-8809G Upto 4.2GHz, 8GB DDR4, 256GB M.2 SSD, AMD Radeon RX Vega M GH, 4k Support, Dual Monitor Capable, Wifi, Bluetooth, Windows 10 Pro 64Bit

Have enabled the plugins Python and Scripting required for python and restarted.
But cannot see any python option in my output log other than cmd.
It does work fine on another Windows box [with NVidia] 4.22 unreal, but this windows configuration does not work.
In File menu, the python tab does not show up either.
In the log the only mention is

“LogPluginManager: Mounting plugin PythonScriptPlugin”

Note*: Build from Source

The issue i had was resolved.i was using Python 32 bit installable on a 64 bit PC. After making the change, it works fine now on windows. thanks.

hmmm, tried rebuilding Unreal 4.21 from source and enabled the necessary plugins in the Editor, but still don’t have the menu and python console showing up. I have Python 3.7 (python.org) and 2.7 (builtin) on my macOS Mojave.

In the Output Log, I see


LogPluginManager: Mounting plugin PythonScriptPlugin

Should I turn on any flags when building Unreal?

What is that location for the macOS 10.14.6?
Do I need to export python installation path with an env variable or alike?
Please give some hints here.

I’ve compiled 4.21.2 on macOS 10.14.6 with the Xcode 11.3.1 (there was a bunch of issues with compiler, code signing etc. but anyway) and I did not succeed with enabling python.
The plugin was enabled in the Plugins > Scripting, along with other plugins in that section, but after restart there is no menu item to run python script.
Also running ‘py path_to_py’ from the Cmd in the “Output Log” does not execute the python script.

I did a research.
First, to detect Python on macOS some code should look for Python.framework.
So in the UE 4.21.2 sources (downloaded from github as zip) I’ve searched through the files and found out that couple of files have this string in a content.
One of these files - Engine/Source/ThirdParty/Python/Python.Build.cs
This file is used to prepare Python plugin build info for UE.
I opened it and what I found were these lines (commented lines are from repo):

else if (Target.Platform == UnrealTargetPlatform.Mac)
{
KnownPaths.AddRange(
new string] {
Path.Combine(PythonTPSDir, “Mac”),
//"/Library/Frameworks/Python.framework/Versions/3.6",
“/Library/Frameworks/Python.framework/Versions/2.7”,
//"/System/Library/Frameworks/Python.framework/Versions/2.7",
}
);
}

You see, the Python framework path that is added to KnownPaths is /Library/Frameworks/Python.framework/Versions/2.7
My macOS 10.14.6 does not have Python at this path.
Instead, it is located at /System/Library/Frameworks/Python.framework/Versions/2.7

So, by simply replacing path one can enable proper Python plugin compilation.

During compilation I’ve faced with 2 errors, where PyErr_BadInternalCall() was improperly treated by the compiler (ISO C++11 does not allow conversion from string literal to ‘char *’)
I’ve replaced 2 occurrences with the code PyErr_SetString(PyExc_SystemError, “Error in a call”).

Described changes allowed me to compile the UE4 editor 4.21.2 from git and have Python command line enabled on macOS 10.14.6!!!