Reading a file in IDLE 3 on Mac-Lion

Hans Mulder hansmu at xs4all.nl
Sat Sep 22 07:11:00 EDT 2012


On 22/09/12 09:30:57, Franck Ditter wrote:
> In article <505ccdc5$0$6919$e4fe514c at news2.news.xs4all.nl>,
>  Hans Mulder <hansmu at xs4all.nl> wrote:
> 
>> On 21/09/12 16:29:55, Franck Ditter wrote:
>>> I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion).
>>> It runs fine and creates the disk file, visible with
>>> TextWrangler or another.
>>> But I can't open it with IDLE (its name is greyed).
>>> IDLE is supposed to read utf-8 files, no ?
>>> This works on Windows-7.
>>
>> There's a little pop-menu below the list of files.
>>
>> It allows you to choose which kind of files you want to open.
>> By default, it is set to "Python files", which greys out all
>> files, except those with a '.py' or '.pyw' extension.
>> Setting it to "Text files" should help, or else try "All files".
>>
>> Hope this helps
>>
>> -- HansM
> 
> Alas this pop-up menu is for Windows only, I don't
> find it on MacOS-X.

It's there on my MacOS X 10.6.5 system.

If your 10.7 system doesn't show it, that's definitely a bug.

> My files are xxx.dat files and not visible,
> even text only (numeric data).

As a work-around, you could name the your file xxx.pyw.

On Windows, there's a functional difference between .py
and .pyw.  On a Mac, there's no functional difference and
Idle is willing to open both types of files, so you could
use .py for code and .pyw for data.

> This can be filed as something to do !

If you're feeling adventurous, you could try solving it
yourself.  Idle is written in pure Python; that makes
this sort of thing a lot easier than if it were in C.

And bug reports with a patch are far more likely to be
picked up by the dev team.

Hope this helps,

-- HansM





More information about the Python-list mailing list