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:
[2019.08.27-03.49.01:010] 0]LogTemp: Display: Module ‘AllDesktopTargetPlatform’ loaded TargetPlatform ‘AllDesktop’
[2019.08.27-03.49.01:179] 0]LogTemp: Display: Module ‘MacClientTargetPlatform’ loaded TargetPlatform ‘MacClient’
[2019.08.27-03.49.01:192] 0]LogTemp: Display: Module ‘MacNoEditorTargetPlatform’ loaded TargetPlatform ‘MacNoEditor’
[2019.08.27-03.49.01:204] 0]LogTemp: Display: Module ‘MacServerTargetPlatform’ loaded TargetPlatform ‘MacServer’
[2019.08.27-03.49.01:217] 0]LogTemp: Display: Module ‘MacTargetPlatform’ loaded TargetPlatform ‘Mac’
[2019.08.27-03.49.01:228] 0]LogTemp: Display: Module ‘WindowsClientTargetPlatform’ loaded TargetPlatform ‘WindowsClient’
[2019.08.27-03.49.01:240] 0]LogTemp: Display: Module ‘WindowsNoEditorTargetPlatform’ loaded TargetPlatform ‘WindowsNoEditor’
[2019.08.27-03.49.01:252] 0]LogTemp: Display: Module ‘WindowsServerTargetPlatform’ loaded TargetPlatform ‘WindowsServer’
[2019.08.27-03.49.01:258] 0]LogTemp: Display: Module ‘WindowsTargetPlatform’ loaded TargetPlatform ‘Windows’
[2019.08.27-03.49.01:327] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android’
[2019.08.27-03.49.01:327] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ASTC’
[2019.08.27-03.49.01:328] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ATC’
[2019.08.27-03.49.01:328] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_DXT’
[2019.08.27-03.49.01:329] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC1’
[2019.08.27-03.49.01:329] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC1a’
[2019.08.27-03.49.01:332] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC2’
[2019.08.27-03.49.01:332] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_PVRTC’
[2019.08.27-03.49.01:332] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘AndroidClient’
[2019.08.27-03.49.01:333] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ASTCClient’
[2019.08.27-03.49.01:333] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ATCClient’
[2019.08.27-03.49.01:333] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_DXTClient’
[2019.08.27-03.49.01:333] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC1Client’
[2019.08.27-03.49.01:334] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC1aClient’
[2019.08.27-03.49.01:334] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_ETC2Client’
[2019.08.27-03.49.01:334] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_PVRTCClient’
[2019.08.27-03.49.01:335] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_Multi’
[2019.08.27-03.49.01:335] 0]LogTemp: Display: Module ‘AndroidTargetPlatform’ loaded TargetPlatform ‘Android_MultiClient’
[2019.08.27-03.49.01:337] 0]LogTemp: Display: Module ‘HTML5TargetPlatform’ loaded TargetPlatform ‘HTML5’
[2019.08.27-03.49.01:384] 0]LogTemp: Display: Module ‘IOSTargetPlatform’ loaded TargetPlatform ‘IOSClient’
[2019.08.27-03.49.01:384] 0]LogTemp: Display: Module ‘IOSTargetPlatform’ loaded TargetPlatform ‘IOS’
[2019.08.27-03.49.01:409] 0]LogTemp: Display: Module ‘TVOSTargetPlatform’ loaded TargetPlatform ‘TVOSClient’
[2019.08.27-03.49.01:409] 0]LogTemp: Display: Module ‘TVOSTargetPlatform’ loaded TargetPlatform ‘TVOS’
[2019.08.27-03.49.01:421] 0]LogTemp: Display: Module ‘LinuxClientTargetPlatform’ loaded TargetPlatform ‘LinuxClient’
[2019.08.27-03.49.01:432] 0]LogTemp: Display: Module ‘LinuxNoEditorTargetPlatform’ loaded TargetPlatform ‘LinuxNoEditor’
[2019.08.27-03.49.01:443] 0]LogTemp: Display: Module ‘LinuxServerTargetPlatform’ loaded TargetPlatform ‘LinuxServer’
[2019.08.27-03.49.01:454] 0]LogTemp: Display: Module ‘LinuxTargetPlatform’ loaded TargetPlatform ‘Linux’
[2019.08.27-03.49.01:490] 0]LogTemp: Display: Module ‘LuminTargetPlatform’ loaded TargetPlatform ‘Lumin’
[2019.08.27-03.49.01:491] 0]LogTemp: Display: Module ‘LuminTargetPlatform’ loaded TargetPlatform ‘LuminClient’
[2019.08.27-03.49.01:492] 0]LogTargetPlatformManager: Display: Building Assets For Windows
[2019.08.27-03.49.01:502] 0]LogAudioDebug: Display: Lib vorbis DLL was dynamically loaded.
[2019.08.27-03.49.01:556] 0]LogShaderCompilers: Display: Using Local Shader Compiler.
[2019.08.27-03.49.02:094] 0]LogDerivedDataCache: Display: Max Cache Size: 512 MB
[2019.08.27-03.49.02:100] 0]LogDerivedDataCache: Display: Loaded Boot cache: C:/Users/t-yoshino/AppData/Local/UnrealEngine/4.22/DerivedDataCache/Boot.ddc
[2019.08.27-03.49.02:110] 0]LogDerivedDataCache: Display: Pak cache opened for reading …/…/…/Engine/DerivedDataCache/Compressed.ddp.
[2019.08.27-03.49.04:124] 0]LogPythonScriptCommandlet: Display: Running Python script: D: est.py
[2019.08.27-03.49.04:125] 0]LogInit: Display:
[2019.08.27-03.49.04:125] 0]LogInit: Display: Success - 0 error(s), 0 warning(s)
[2019.08.27-03.49.04:126] 0]LogInit: Display:
Execution of commandlet took: 0.00 seconds
[2019.08.27-03.49.04:204] 0]LogShaderCompilers: Display: Shaders left to compile 0
FGlobalReadBuffer::ReleaseRHI
FGlobalDynamicReadBuffer::Cleanup()
FGlobalReadBuffer::ReleaseRHI
FGlobalDynamicReadBuffer::Cleanup()
FGlobalReadBuffer::ReleaseRHI
FGlobalDynamicReadBuffer::Cleanup()
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")
116406776
(116406776)
August 13, 2020, 6:59am
8
嗯,找了半天,就是这个。后台运行ue4 有助于 资产导入,动画导入,灯光烘焙等 大量重复操作。免去等待