I have the current Windows binary install of Python 2.3.4 on my
Windows XP system.
I am pained to discover that tkFileDialog.as kdirectory() returns a
mangled path when a directory is selected which has non-ascii Unicode
path, as in Kanji characters, i.e. the usull "????" in place of the
original UTF-8 code points. .
After some time spent Google'ing. I don't find a discussion of this.
Is there some option or configuration change I can make to fix this?
I can roll my own file-dialog , but I prefer to re-use code. 2 4270
Read Roberts <rr******@adobe .com> wrote in message news:<ma******* *************** *************** *@python.org>.. . I have the current Windows binary install of Python 2.3.4 on my Windows XP system.
I am pained to discover that tkFileDialog.as kdirectory() returns a mangled path when a directory is selected which has non-ascii Unicode path, as in Kanji characters, i.e. the usull "????" in place of the original UTF-8 code points. .
After some time spent Google'ing. I don't find a discussion of this. Is there some option or configuration change I can make to fix this? I can roll my own file-dialog , but I prefer to re-use code.
I had a problem with using tkFileDialog.fi lename between Windows and
Linux. The solution I got was to use unicode(). In article <fa************ **************@ posting.google. com>, ti************* *@nvl.army.mil (Tim Williams) wrote:
>I'm using Python 2.3.2 and tkFileDialog in a program I have. I'm >trying to use this on Linux (RH 8.0) and Windows 2000. When I
first >upgraded from v2.2 to v2.3. I noticed that >tkFileDialog.a skopenfilename( ) returns a tuple on Cancel instead
of >''. I found that the Windows version still returns a string ('').
Now >I'm finding out that tkFileDialog.Di rectory().show( ) does this
too. ... >How can I check tkFileDialog to do the "right" thing? All I want
is >the string that contains the path, but I want this to work on
both >Linux and Windows.
Is this the sort of thing you want?
dirobj = tkFileDialog.as kdirectory() if not dirobj: # user Cancelled; works whether the return is '' or () return
# dirobj may be a string or a Tk_Obj dirname = unicode(dirobj)
The same code should work for askopenfilename .
HTH
Thank your for your response. I did see your
e-mail when googl'ing for similar issues.
However, the problem you had was that the the
object returned on cancelling is different
bertween Linux and Windows.
My problem is that when you do select a directory
with the tkFileDialog.as kdirectory() , on
Windows the object returned is a byte string,
with the non-ascii characters converted to '?".
Applying the 'unicode" function to this cannot
restore the lost data.
The particular path i am struggling with a a
parent directory with the utf-8 name:
"\343\201\246\3 43\201\231\343\ 201\250\343\203 \225\343\202\25 1\343\203\253\3 43\202\277\343\ 202\231"
- Read Roberts
At 5:06 AM -0700 10/8/04, Tim Williams wrote: Read Roberts <rr******@adobe .com> wrote in message news:<ma****** *************** *************** **@python.org>. .. I have the current Windows binary install of Python 2.3.4 on my Windows XP system.
I am pained to discover that tkFileDialog.as kdirectory() returns a mangled path when a directory is selected which has non-ascii Unicode path, as in Kanji characters, i.e. the usull "????" in place of the original UTF-8 code points. .
After some time spent Google'ing. I don't find a discussion of this. Is there some option or configuration change I can make to fix this? I can roll my own file-dialog , but I prefer to re-use code.
I had a problem with using tkFileDialog.fi lename between Windows and Linux. The solution I got was to use unicode().
In article <fa************ **************@ posting.google. com>, ti************* *@nvl.army.mil (Tim Williams) wrote:
>I'm using Python 2.3.2 and tkFileDialog in a program I have. I'm >trying to use this on Linux (RH 8.0) and Windows 2000. When Ifirst >upgraded from v2.2 to v2.3. I noticed that >tkFileDialog.a skopenfilename( ) returns a tuple on Cancel insteadof >''. I found that the Windows version still returns a string ('').Now >I'm finding out that tkFileDialog.Di rectory().show( ) does thistoo. ... >How can I check tkFileDialog to do the "right" thing? All I wantis >the string that contains the path, but I want this to work onboth >Linux and Windows.
Is this the sort of thing you want?
>>> dirobj = tkFileDialog.as kdirectory() if not dirobj: # user Cancelled; works whether the return is '' or () return
# dirobj may be a string or a Tk_Obj dirname = unicode(dirobj) ** The same code should work for askopenfilename .
HTH -- http://mail.python.org/mailman/listinfo/python-list This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim Williams |
last post by:
I just installed Python 2.3 on my Redhat system. When I tried to run
one of my programs that use tkFileDialog.askopenfilename(), I got an
error because it returns a tuple instead of a null string when I
select Cancel.
Python 2.2:
Python 2.2.2 (#3, Jan 21 2003, 08:39:06)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
|
by: Mike Abel |
last post by:
Hello
i have a Linux Mandrake Distribution with Python 2.3 and Tcl/Tk 8.4.
Python 2.2 and Tcl/Tk 8.3.3 returns an String if i made this:
x = tkFileDialog.askdirectory(initialdir="was auch immer", title="xxx")
print type(x)
<type 'str'>
|
by: Tim Williams |
last post by:
Hi.
I'm using Python 2.3 and trying to use tkFileDialog to get a list of
files. I get a message about the '-multiple' option is not a valid
option in the call to Open.
Python 2.3 (#1, Aug 4 2003, 10:43:11)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
|
by: Tim Williams |
last post by:
I'm using Python 2.3.2 and tkFileDialog in a program I have. I'm
trying to use this on Linux (RH 8.0) and Windows 2000. When I first
upgraded from v2.2 to v2.3. I noticed that
tkFileDialog.askopenfilename() returns a tuple on Cancel instead of
''. I found that the Windows version still returns a string (''). Now
I'm finding out that tkFileDialog.Directory().show() does this too.
>>> d1=tkFileDialog.Directory().show()
>>>...
|
by: Irmen de Jong |
last post by:
Hi,
I'm having trouble with the code below.
It's just a regular Tk text widget in which you can type and
select text as expected, however the call to tkFileDialog.askopenfilename()
seems to screw things up. After the file dialog, I can no longer use
the Text widget (typing, selecting, it doesn't work anymore!)
What am I doing wrong?
TIA,
--Irmen de Jong
| |
by: Justin Straube |
last post by:
Hopefully someone can catch what im missing here. Ive googled this and I think
Ive got the filetypes arg written properly, but I get a traceback when calling
this function.
Heres the code followed by its traceback.
def do_ask_fn_1():
z = askopenfilename(title=TITLE, initialdir=Dst_Dir,
filetypes=(('AIFF Files','*.aiff'),
("AU Files", "*.au"),
|
by: John Wheez |
last post by:
Hi all,
I'm using teh tkFileDialog to let teh user select a directory. We have
long names which make
it difficult to view the directories.
For some reason the GUI windows doesn;t expand on Windows like it does
on OS X or Linux.
Is there a method to make the widths of the tkFileDialog windows larger
when using Windows XP?
|
by: cdroulers |
last post by:
Hello,
I am working on a school project that requires me to get the path of a
filename for future treatment.
I've tried getting a file with tkFileDialog.askopenfile.
********************************************
import tkFileDialog
file = tkFileDialog.askopenfile()
print file
|
by: Gheorghe Postelnicu |
last post by:
In our example, try replacing the last line with
print file.name
---------- Forwarded message ----------
From: cdroulers@hotmail.com
To: python-list@python.org
Date: 8 Nov 2006 11:01:08 -0800
Subject: Problem getting a file pathname with tkFileDialog
Hello,
|
by: Traclo |
last post by:
Hello all! I have a problem concerning tkFileDialog. When I use the the askopenfilename command to open a text file it opens a tkinter window (apart from the file browsing window) which refuses to close once I've selected and opened the file. It just stays there and when clicked on says not responding.
I am using Vista, writing this file in Wing, and have the latest version of python
My code for this interaction goes like this:
import...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |