Announcement

Collapse
No announcement yet.

[PYTHON] [QUESTION] Cannot use arguments or user input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [PYTHON] [QUESTION] Cannot use arguments or user input

    Hey everybody! I have been trying out the Python scripting in Unreal with the help of the resources kindly provided by Epic and the community here. Very happy with it so far, it's a great feature that is really bringing Unreal workflows to the next level!

    Although there has been an issue that I was hoping to get some help with.

    Whenever I run my script (or any script actually. I did a sanity check with a hello world) from the command line with an argument or even a " " appended to line after the python file I get the following:

    LogPython: Error: SyntaxError: invalid syntax (<string>, line 1)

    Basically the command line does not support arguments, or at least not in the way given as an example in the documentation PDF.

    I even tried to compromize and use simple user input. I tried input and raw_input and the behavior was the same for both. The command line advanced by itself without waiting for the input, and gave me this error:

    LogPython: Error: Traceback (most recent call last):
    LogPython: Error: File "[myPath]test.py", line 11, in <module>
    LogPython: Error: myString = raw_input("Enter string, yo: ")
    LogPython: Error: EOFError: EOF when reading a line


    Did anyone manage to use arguments with python scripts? Is there something I am missing, or is it currently still impossible?

    #2
    How exactly are you running your script? I know the core Python support (for the Output Log execution and "PY" cmd) didn't support file arguments in 4.19, but that was fixed for 4.20 (along with improved support for start-up scripts and additional import paths, amongst other things).

    Comment


      #3
      Originally posted by Jamie Dale View Post
      How exactly are you running your script? I know the core Python support (for the Output Log execution and "PY" cmd) didn't support file arguments in 4.19, but that was fixed for 4.20 (along with improved support for start-up scripts and additional import paths, amongst other things).
      Oh, thanks a lot for the info! Wasn't using 4.20 yet as I usually wait for the full stable release. As you are saying, we were using the PY command in UE 4.19 and that was giving us the errors, so I am very happy that it is now possible in 4.20. Will definitely check it out when the 4.20 release comes out!!

      Comment

      Working...
      X