msg85658 - (view) |
Author: daku9999 (daku9999) |
Date: 2009-04-06 17:45 |
from tkFileDialog import askopenfilenames
a = askopenfilenames()
print a
print type(a)
'''
--output--
J:/PortablePython_1.1_py2.6.1/Aatest26/tk_new/rgb2hex.py
J:/PortablePython_1.1_py2.6.1/Aatest26/tk_new/bluebtn.jpg
J:/PortablePython_1.1_py2.6.1/Aatest26/tk_new/redbtn.jpg
<type 'unicode'>
'''
---- behaviour seen on windows xp 2.6.1 python release. Linux
distributions seem fine.
---- parsing above string (as it's not a tuple anymore) is difficult as
it is a list of filenames separated by a space but spaces can be in the
middle of filenames.
|
msg91291 - (view) |
Author: Gabriel Genellina (ggenellina) |
Date: 2009-08-05 01:11 |
With 2.6.2 on Windows, I get filenames surrounded by {}, all in a
single unicode string.
The change may be related to the new Tk library used, not directly the
tkFileDialog module.
(BTW, I don't see *any* unit tests for tkinter :( )
|
msg91297 - (view) |
Author: Guilherme Polo (gpolo) * |
Date: 2009-08-05 02:29 |
> With 2.6.2 on Windows, I get filenames surrounded by {}, all in a
> single unicode string.
This string surrounded by { } indicates it is supposed to be a tcl
list, which didn't get converted but should be done by tkFileDialog.
> The change may be related to the new Tk library used, not directly the
> tkFileDialog module.
>
It could be, or not. A simple solution would be to call the splitlist
function from _tkinter on that string, which tkFileDialog should be
doing indifferently of expecting objects from _tkinter or not.
> (BTW, I don't see *any* unit tests for tkinter :( )
>
There are some one a separated branch for now, but it doesn't include
tkFileDialog yet.
|
msg98530 - (view) |
Author: Clovis Fabricio (nosklo) * |
Date: 2010-01-29 19:23 |
I've written a quick workaround for the issue, where I manually split the filenames and always return a tuple.
It might be useful to someone experiencing this problem, so I'm adding it to the issue here.
|
msg107932 - (view) |
Author: vijay (luckycusp) |
Date: 2010-06-16 16:02 |
Two issues related with the workaround suggested by nosklo.
1. Splitting the filepaths isnt simple, as there may be blank spaces etc.
2. We have different versions of Python installed in our Lab machines, some have 2.5 and others got 2.6. If I run the code using the version2.6 workaround on a machine with version2.5, obviously it gives an error!!
Any updates on a fix? This bug is really giving me a hard time.
|
msg107935 - (view) |
Author: vijay (luckycusp) |
Date: 2010-06-16 16:46 |
Update!! I found a very good workaround for this and it works very nicely, with both 2.5 and 2.6 versions.
Below is the segment from my code:-
from Tkinter import *
import tkFileDialog
master = Tk()
master.withdraw() #hiding tkinter window
Inputfiles = tkFileDialog.askopenfilenames(title="Select the source input file(s)", filetypes=[("mpf file",".mpf"),("All files",".*")])
#Heres the TRICK!
InputfilesList = master.tk.splitlist(Inputfiles)
|
msg107947 - (view) |
Author: Clovis Fabricio (nosklo) * |
Date: 2010-06-16 18:49 |
UGH! Sorry for that, I mispasted something and didn't notice, since it filled the comment entry box perfectly :(
This is the real message I meant to paste:
----------------------------
vijay,
The workaround I provided above takes the blank spaces in filepaths
you mention into account and splits the paths correctly in all
situations I can think of. I'm using it in production now for over an
year, and had no issues at all. Perhaps you can provide an example of
path that would break the code, so it can be fixed.
thanks in advance
Clovis
|
msg107952 - (view) |
Author: vijay (luckycusp) |
Date: 2010-06-16 19:45 |
Hi Clovis
Ok, I did not check if your split string function check for spaces or not, sorry for that.
In my first post I mentioned this:-
"2. We have different versions of Python installed in our Lab machines, some have 2.5 and others got 2.6. If I run the code using the version2.6 workaround on a machine with version2.5, obviously it gives an error!!"
Infact I started out using your split string function but it was on a machine with Python2.6. It worked fine. Then I ran the same code on a machine with version Python2.5 and it threw an error when I tried calling your function, because the argument I passed to your function was already a tuple and not a string!! (I hope I could explain without confusing)
I would prefer my code to have some level of downward compatibility (to be able to run on Python of lower versions). Thats the reason I prefer to use the 'splitlist' method from Tkinter, as I dont need to change my code for different Python versions.
Best Regards
Vijay
|
msg120740 - (view) |
Author: Peter Hall (pfhall) |
Date: 2010-11-08 13:37 |
There seems some similarity between this issue and issue #10316 which occurs on Linux.
|
msg197765 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-09-15 12:41 |
Is it still reproducible on 2.7?
|
msg205809 - (view) |
Author: Martin Miller (martinmiller) |
Date: 2013-12-10 12:59 |
Answering Serhiy Storchaka's question: Yes it's still reproducible with 2.7.6.
|
msg205816 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-12-10 14:37 |
What are values of Tkinter.wantobjects, Tkinter._support_default_root, Tkinter._default_root, Tkinter._default_root.wantobjects()? Before and after calling tkFileDialog.askopenfilenames().
|
msg205840 - (view) |
Author: Martin Miller (martinmiller) |
Date: 2013-12-10 18:24 |
Requested information:
Before
Tkinter.wantobjects: 1
Tkinter._support_default_root: 1
Tkinter._default_root: None
Tkinter._default_root has no attribute 'wantobjects'
After
Tkinter.wantobjects: 1
Tkinter._support_default_root: 1
Tkinter._default_root: .
Tkinter._default_root.wantobjects(): True
|
msg210781 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2014-02-09 19:32 |
Thank you Martin.
May be this issue was fixed in issue19020.
|
msg222149 - (view) |
Author: Som Veettil (som_veettil) |
Date: 2014-07-03 05:12 |
i had similar issue with python 2.7.. works fine with fix provided by vijay (luckycusp)
msg107935 - (view) - http://bugs.python.org/msg107935
thanks a lot.
|
msg222304 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2014-07-04 18:40 |
Som, what is full version of your Python?
|
msg222569 - (view) |
Author: Som Veettil (som_veettil) |
Date: 2014-07-08 17:19 |
@Serhiy Storchaka - its Python 2.7.6
|
msg222573 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2014-07-08 18:08 |
This bug was fixed in 2.7.7.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:47 | admin | set | github: 49962 |
2014-07-08 18:08:10 | serhiy.storchaka | set | status: open -> closed superseder: Regression: Windows-tkinter-idle, unicode, and 0xxx filename resolution: duplicate messages:
+ msg222573
|
2014-07-08 17:19:51 | som_veettil | set | messages:
+ msg222569 |
2014-07-04 18:40:28 | serhiy.storchaka | set | messages:
+ msg222304 |
2014-07-03 05:12:42 | som_veettil | set | nosy:
+ som_veettil messages:
+ msg222149
|
2014-02-09 19:32:49 | serhiy.storchaka | set | messages:
+ msg210781 |
2013-12-10 18:24:30 | martinmiller | set | files:
+ python_issue_5712.py
messages:
+ msg205840 |
2013-12-10 14:37:26 | serhiy.storchaka | set | messages:
+ msg205816 |
2013-12-10 12:59:17 | martinmiller | set | nosy:
+ martinmiller messages:
+ msg205809
|
2013-10-13 17:59:53 | georg.brandl | link | issue8010 superseder |
2013-09-15 12:41:15 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka
messages:
+ msg197765 versions:
- Python 2.6 |
2013-03-21 02:14:47 | r.david.murray | set | messages:
- msg184831 |
2013-03-21 02:13:44 | python-dev | set | nosy:
+ python-dev messages:
+ msg184831
|
2010-11-08 13:37:21 | pfhall | set | nosy:
+ pfhall messages:
+ msg120740
|
2010-06-16 19:45:03 | luckycusp | set | messages:
+ msg107952 |
2010-06-16 19:33:15 | eric.araujo | set | messages:
- msg107946 |
2010-06-16 18:49:29 | nosklo | set | messages:
+ msg107947 |
2010-06-16 18:45:57 | nosklo | set | messages:
+ msg107946 |
2010-06-16 16:46:33 | luckycusp | set | messages:
+ msg107935 |
2010-06-16 16:02:31 | luckycusp | set | nosy:
+ luckycusp messages:
+ msg107932
|
2010-04-03 02:37:45 | nosklo | set | versions:
+ Python 2.7 |
2010-03-11 19:38:09 | dhalbert | set | nosy:
+ dhalbert
|
2010-01-29 19:23:42 | nosklo | set | files:
+ issue5712_workaround.py nosy:
+ nosklo messages:
+ msg98530
|
2009-08-05 02:29:58 | gpolo | set | messages:
+ msg91297 |
2009-08-05 01:11:27 | ggenellina | set | nosy:
+ ggenellina messages:
+ msg91291
|
2009-08-03 18:33:23 | gpolo | set | nosy:
+ gpolo
|
2009-04-06 17:45:10 | daku9999 | create | |