hexagon logo

Simple input in python script

Hello everyone, i am learning python, and trying simple programs using python in Adams.
My problem is how to ask for input string:
 
Something like:
name=input()
 
is giving error such:
 
File "<string>", line 1, in <module>
EOFError: EOF when reading a line
 
or macros in adams python should be just script without input?
 
Jozef
Parents
  • Here is a completely different way to do this that a colleague shared with me. It is so unsupported that I didn't want to share it, but it is quite interesting so here goes:
     
    ---------------------
    import qt
    i, status = qt.QInputDialog().getInt(None, "get int", "number")
    print i
    ----------------------
     
    I say this is "so unsupported" because it is using the underlying graphics toolkit (Qt) directly. We don't document this nor support this because it is our internal tool that can change from release to release. So I don't recommend using it in any kind of 'production' capacity!
     
    Thanks,
    Kent
     
Reply
  • Here is a completely different way to do this that a colleague shared with me. It is so unsupported that I didn't want to share it, but it is quite interesting so here goes:
     
    ---------------------
    import qt
    i, status = qt.QInputDialog().getInt(None, "get int", "number")
    print i
    ----------------------
     
    I say this is "so unsupported" because it is using the underlying graphics toolkit (Qt) directly. We don't document this nor support this because it is our internal tool that can change from release to release. So I don't recommend using it in any kind of 'production' capacity!
     
    Thanks,
    Kent
     
Children
No Data