Forum

#1 2016-12-20 18:11:24

Q51
New member

Open File Browser

Hello,

I'm writing a little script to learn Python. I'd like to automate the pluging of the texture maps coming from substance. In order to do that, I need the user to select the directory where the maps are, and I know the built-in module Tkinter could help me do that, but I get an error each time I try to import it:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named Tkinter

I can locate the Tkinter files in the guerilla directory and the sys.path contains the right paths I think.

Am I doing this all wrong or is there an other way of doing this ?

Thanks,
Quentin

Offline

 

#2 2017-03-18 10:03:55

Fadre
New member

Re: Open File Browser

By the way, I had a similar problem. This may be due to a proxy server, which I started to use lately? I understand that it seems irrelevant, but you never know.

Offline

 

#3 2017-03-23 12:42:52

doubleailes
Member

Re: Open File Browser

Hi Quentin,

If your module is not importable that's mean guerilla donc find this lib.

You need to use sys.path.append which is simple but a little bit dirty.

Code:

if not '/PathTotheLibrary/' in sys.path:
    sys.path.append('/PathToTheLibrary')

Have a look to this page for digging http://sametmax.com/les-imports-en-python/


Phil

Offline

 

#4 2017-04-25 21:18:45

xiaoshibo
Member

Re: Open File Browser

Hi,

I am curious, when you say build-in module.... I am not sure Tkinter is build-in.
what if you write 'import tkinter' in your script editor? does it tell you 'ok' or 'No module named tkinter' ?

if it's not a 'ok' message, i think you haven't install tkinter yet.


Lighting Artist

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB