Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109390

Re: [Q] ImportError by __import__() on Python >= 3.4

From Makoto Kuwata <kwa@kuwata-lab.com>
Newsgroups comp.lang.python
Subject Re: [Q] ImportError by __import__() on Python >= 3.4
Date 2016-06-03 08:54 +0900
Message-ID <mailman.110.1464911644.1839.python-list@python.org> (permalink)
References <CAFTm5Rv+K6KFMt2FXfWfZtn5gAnJtf4XawfijRpO4vcJf73h7g@mail.gmail.com> <CAGgTfkPEf3vTWV+WkF8ZZBC=6Oa1NkzhP26tSEX0JNLxHt4DMg@mail.gmail.com> <CAFTm5RujjmjZ4TRg68=jBnHn2rnp=-4ezPcARv4h3X3kTDnF+Q@mail.gmail.com>

Show all headers | View raw


On Thu, Jun 2, 2016 at 11:15 PM, Michael Selik <michael.selik@gmail.com>
wrote:

>
>
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <kwa@kuwata-lab.com> wrote:
>
>>             os.mkdir(name)
>>             with open(name + "/__init__.py", 'w') as f:
>>                 f.write("X=1")
>>                 f.flush()
>>
>> Please give me any advices or hints.
>>
>
> This wasn't your question, but you don't need to flush the file. The
> ``with`` statement will automatically flush and close your file for you
> after you exit the block.
>

Thanks. I'm sure that with-statement close file, but not sure whether it
flushes or not.


Any hints or advices for ogiginal question?

--
regards,
makoto

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Q] ImportError by __import__() on Python >= 3.4 Makoto Kuwata <kwa@kuwata-lab.com> - 2016-06-03 08:54 +0900

csiph-web