Sunday 17 December 2017

tkinter - Python import and run a python script that is in a different directory

I currently have a GUI made with tkinter that allows the
user to select radio buttons that will import different python scripts that all perform
different functions. Some of these scripts are in the same directory, so importing has
not been an issue, but I have a few scripts in a different directory (has to stay there
due to dependencies), but want the user to be able to select this script from the GUI to
have it run instead of them having to go into terminal and run the script that way.



More details:
My current file is in
Finance/Ingest while I have a script, combine.py, in
dw/



What I want:
I have radio button
and when the user click the submit button it calls this function, which gets the radio
buttons values. If the value == 1 then I want it to import the script and run it. Below
is whaty I currently have but it keeps saying "cannot find module dw." Any help would be
appreciated!!!




def
Rel_Button():
Run_DB_Rel_Parse = DB_Rel_Parse.get()
Run_DB_Req_Rel
= DB_Req_Rel.get()
Ingest_DB_Rel = DB_Rel.get()

if
Run_DB_Rel_Parse == 1:
import
dw.combine

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...