[python-win32] drag&drop files with non-ASCII filenames?

Tim Roberts timr at probo.com
Tue Dec 15 14:10:43 EST 2015


Ulli Horlacher wrote:
> I have a python 2.7 program which runs in a console window and upload
> files. 
> To specify the files, the user uses Windows drag&drop (via explorer) or
> copy&paste.

This is hopeless.  In addition to the normal difficulties in
string/Unicode conversions, you have the added limitations of the
current console code page.  You simply cannot type characters in a
Windows console that are not present in your current code page.

You need to make this a GUI app, not a console app.

Your code is also making assumptions about the behavior of the console
window that are not warranted.  No one promised, for example, that a
string pasted with "paste" is going to fire kbhit() continuously until
empty.


> To read it I use:
>
> file = get_paste()

It is unwise to use the name of a built-in type as the name of a variable.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list