Python Forum

Full Version: How to pass args from GUI to pre-written script.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

First post. New to Python. From a Java background.

I am trying to create a simple GUI for using existing Python scripts without having to use terminal and have run into a brick wall when trying to pass arguments to a method in the script. The method from the script I am trying to pass args to is called alignMain(args) and has such args as args.outputDir args.inputDir.

I am trying to call it like this from my script:

align_dlib.alignMain(outputDir=alignDir.get(), inputDir=rawDir.Get(), landmarks=landmark)

The error I get is: TypeError: alignMain() got an unexpected keyword argument 'outputDir'

Then as a test, I tried without the keyword and I get this error: AttributeError: 'str' object has no attribute 'outputDir'

What am I doing wrong here?

Thank you. (Happy to provide more info if needed.)
Quote:I am trying to create a simple GUI for using existing Python scripts without having to use terminal
Im not sure why you would do this. The terminal is usually better than GUI in terms of speed and ease. If the program is hard to use via arguments then it falls on the programmer who failed to make it easy.

Quote: (Happy to provide more info if needed.)
As to fix your problem...i htink more info would be required.
I want to make an app with it as a part which can be used on different platforms. This is just one component. Do you require any specific info?