Download

Print from python by running from the command line

I want to run Python from the command line.
It was confirmed that the python file was executed from the command line.
However, neither the Print function nor the Unreal.log function displayed the log.

Is there a way to print from python by running from the command line?



import unreal
print( "Hello world." )

Execute log:

like this Untitled.png

That’s true. However, I wanted to do the execution and verification without starting the editor.

Perhaps it can be done by creating and checking log files myself.
I posted in the hope of a better iteration.

Below is from CMD command, However you cannot just import unreal and separate with UE4editor, python will read C++ function from UE UE4Editor-Cmd.exe “C:\projects\MyProject.uproject” -run=pythonscript -script=“c:\my_script.py”

Another way I am investigating is Using UDP, 4.23 have new PY feature is python remote execution.
Unfortunately I am writing one ,so no example to share
hope it can help you

Hello,
do not look at the output of UE4Editor-cmd.exe but use the log inside the “MyProject\Saved\Logs” files

print & unreal.log_warning & unreal.log_error outputs can be found in your project “\Saved\Logs” files
while unreal.log_warning & unreal.log_error are the only one visible in the direct output of UE4Editor-cmd.exe.



import unreal

print "Python output - Normal print"
unreal.log_warning("Python output - log warning")
unreal.log_error("Python output - log error")


嗯,找了半天,就是这个。后台运行ue4 有助于 资产导入,动画导入,灯光烘焙等 大量重复操作。免去等待