was Japanized?


I modified a script,
Already you know , it is a file chooser script that pops windows dialogue.

This script has a problem when it encode filepath.
I use


as encoding , but I should use


in this case,I think.

I tested follow three pattern…
(1):sys.getdefaultencoding() - x(utf-8) not exitst
(2):sys.stdout.encoding - o(cp932)
(3):sys.getfilesystemencoding() - ?(mcbs) critical error

My environment:
OS : Windows 2000(JP)
blender: Ver. 2.44
python: Ver. 2.5


""" Registration info for Blender menus:
Name: 'Open .blend'
Blender: 237
Group: 'Help'
Tooltip: 'Open .blend files using standard Windows file dialog'

# --------------------------------------------------------------------------
# Copyright (C) 2005-2006 Mariano Hidalgo
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# --------------------------------------------------------------------------

__author__ = "Mariano Hidalgo AKA uselessdreamer"
__url__ = ("blender", "elysiun")
__version__ = "1.0"

__bpydoc__ = """
Allows you to open a .blend file using the standard Windows file dialog.
The script recalls your last chosen folder and defaults there. If the
folder no longer exists, it defaults to C:\\.

Needs a full Python installation to work (
##modified for Japanese env , by manda[2007.05.20]

import Blender
import os
import sys
import tkFileDialog
import Blender.sys as Bsys
from Blender import Registry

from Tkinter import Tk

# get a encoding string (Is this correct?)
file_enc = sys.stdout.encoding

t = Tk()
t.wm_title("Open Blend")

d = Registry.GetKey('OpenBlend', True)
if d:
	last_folder = d['last_folder'].encode(file_enc) # encodings
	last_folder = u"C:\\"
if Bsys.exists(last_folder):
f = tkFileDialog.askopenfilename(title="Open Blend",filetypes=[(".blend files", "*.blend")])

if f:
	d = {}
	d['last_folder'] = Bsys.dirname((f).replace("/","\\"))
	Registry.SetKey('OpenBlend', d, True)
	if f[-6:] == ".blend":
		g = f.encode(file_enc)	# encodings
		if Bsys.exists(g):
		Draw.PupMenu("Error!%t|Not a .blend file")

and ( C:/python25/Lib/site-packages/)

import sys

in blender 2.44 ,it can display Unicode characters on File Window.
but it is… :frowning:


Hi MandaSan, i’m afraid but i think i’m not the only one who does not get the point. What about posting a blend?

Hi 3D-Penguin san,

sorry for my poor english.

I’ts not about posting a .blend file.
This issue about loading blendfile to blender.exe (using python) when filename (or filepath) includes Japanese character,like this;


I want to get this filepath to use Tk’s(windows) file dialog,and load the file to blender.exe.

This code is Ok;

import sys
import Blender.sys as Bsys


but this code can’t find filepath


I modify to reading a .blend file that it has Japanese name,
it requiers convert from unicode encoding to system encoding.

I try first, it coud’t find a path;

f = u"C:\dir\パス\ぶれんだあ.blend"
g = f.encode(sys.getdefaultencoding())	# encodings unicode -> (utf-8)

Second, I caught a critical error ;

f = u"C:\dir\パス\ぶれんだあ.blend"
g = f.encode(sys.getfilesystemencoding())	# encodings unicode -> (mcbs)

Finally, I could ;

f = u"C:\dir\パス\ぶれんだあ.blend"
g = f.encode(sys.stdout.encoding)	# encodings unicode -> (cp932)

what’s the difference?

I use windows200 (JP).


I think this script opens blend files out of exe files except it can now open Japanese files too. Am I right?

Hi C-106 Delta san,
thank for your reply.

Probably yes… ah, I forgot to write about that…

Here is two screenshot, do you think about?
(Most of you , this may not big deal.)
With tk
File window x2


I think the computer running the script may need both English and Japanese text in order work correctly but it is still very helpful. Thank.

I was looking the script over again and I don’t think it hacks the file, it only converts it from Japanese to English, very cool.


Now I can read/write .blend file via Tkinter :smiley:


Hey does anyone know where I can fidn the original version of this script(englis version hopefully)?

plec, I have all the scripts…
check the system toolkit on the wiki (in my sig) for a working version.

the easy way around this should be:

# -*- coding:Shift_JIS -*-



This should fix your problem.

Edit: if it appears again due to changes in the API.


thanks I got the scripts. However. how do you use dialog script?

hi, Windows Dialog Pack:
there are 3 scripts included in the System Bundle.
Place these in afolder called Py_system in .blender/scripts.
then run them from the Scripts System menu in Blender.

Note: These scripts need a full Python install to work.
Also they are for Windows xp os only. not tested with vista.


It was giving me an error that is why I asked about it. I am under xp64 and here is the message

import tkFileDialog

File “E:\Python25\lib\lib-tk”, line 43, in <module>
from tkCommonDialog import Dialog
File “E:\Python25\lib\lib-tk”, line 11, in <module>
from Tkinter import *
File “E:\Python25\lib\lib-tk\”, line 37, in <module>
import FixTk # Attempt to configure Tcl/Tk without requiring PATH
File “E:\Python25\lib\lib-tk\”, line 24, in <module>
import _tkinter
ImportError: DLL load failed with error code 193

That is a problem with tkinter module, probably not ported to 64bit Windows. Check google for the many errors that are related to that - you’d need a properly compiled module, but I’ve no idea how to get that (other than maybe 64bit python install?)


jesterKing, that would make sense. Thanks for shedding some light on this.

Thanks for your reply to my old post :).

but i think ,about their encoding ,UTF-8 is better than Shift_JIS

# あああ

if this script file’s encoding is Shift_JIS,you may cought an error, you sould specify,

# -*- coding:Shift_JIS -*-
# あああ

but UTF-8 (encoded), you can run even if you forgot to add “# -- coding:UTF-8 --”:smiley:

by the way, I think blender need some improvement for localization.

for my environment, i cought many time an encoding error with commented line with French when run the script:(
text window in blender cannot display non-ascii character(most of Kanji ,Hiragana…) correctly,even if “International Fonts” is on.
and dosplay on the file window ,too:(
sorry,it is off-topic…