Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Makoto Kuwata Newsgroups: comp.lang.python Subject: Re: [Q] ImportError by __import__() on Python >= 3.4 Date: Fri, 3 Jun 2016 08:54:00 +0900 Lines: 29 Sender: kwatch@gmail.com Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ygSBM8UTOMNPZcrfI1uQEwtKLqc4sP7/95SR6Nbe4y5A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'subject:Python': 0.05; 'exit': 0.07; "'w')": 0.09; 'block.': 0.09; 'flush': 0.09; 'question?': 0.09; 'file,': 0.15; 'thu,': 0.15; '11:15': 0.16; '2016': 0.16; '``with``': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; 'email addr:gmail.com>': 0.18; 'thanks.': 0.18; 'subject:] ': 0.19; 'to:name:python- list@python.org': 0.20; 'file.': 0.22; 'header:In-Reply-To:1': 0.24; 'not.': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.30; 'statement': 0.32; 'michael': 0.33; 'file': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'question,': 0.35; 'but': 0.36; 'received:209.85': 0.36; "wasn't": 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'received:209': 0.38; 'received:209.85.220': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'close': 0.61; 'hints': 0.66; 'kuwata': 0.84; 'makoto': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to; bh=E05uUqxulpa+iMFjolRJ6Zc8hJStEUlcayrQ6TqEBUA=; b=mzIk7SRdIDj1wONl/BSh0l/WZd6RJAC4EqgoWJdWh75DiW2ReZIlt+ljrU5POqYQ2Y EJooJBr5tHbPP/qNPxfoKGZGmmWnNzAoAJNLnA6uqY5f3Fe3avcpAE6HvkXe9RlhoIg5 VtuMzSULhOT34Pg11zbHZfOjR8Ea9mOYHlTpz3mQYVkk1UkZ8wfngg6zMIJiahkMeA4v XCJG+PF3Z0Bbvjcb7cuqrOpxiOuiyxbMjMh6IFHT6eQJqKlhzr076xNXl0ATpA2tW1TM ciVr2AHB5gOhUxRVUhjdks/6waY+pPKD9aeHaxrvrs5eyW/cw17jcStFD9buSNlqbipm Fm0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kuwata-lab-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to; bh=E05uUqxulpa+iMFjolRJ6Zc8hJStEUlcayrQ6TqEBUA=; b=L1szf4rzv61y0zYZ36Hm3jCTmdzS7Emst4wyvd4JY8YhldIz7Sdxyaz6AYWPKGDZlT HztZ2hyqryCOHrUk7aMDZwK3DPz65MsXK1ViBrBy/cV4IK99jV0TKIKCe2GJCIcsje4A By7EO/llzqTwuTlNcQHPJv0IdrjlD/1a2oAdRCtG2pUxtelZi6lhEuSiJ2ADVN3goNBY /X8pwrjSgKVjK/CbcThYLv6YtlVuGQTTDl3Es8s8QpTWPG3aS46SiV3GGD01Vo/nITgD 4iDwm32QCQD4L8Z41ZwRUvLNwiHlu9+5JwHzhjT0eyq4rC02VATIYYG89ah9SYn/2ltD 9E4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to; bh=E05uUqxulpa+iMFjolRJ6Zc8hJStEUlcayrQ6TqEBUA=; b=A623R+iiWQiZEgq7jn8plrHqC+BJ52eYddNFuYhAAsmr3hySULZLRJdRqCvUio4MIv 0M5lYK/TWdka6XlIc86lbYAUQeyWGAomli1JNf88Eclypj1uabmWXP5JVwMpEKSY+q2J 2ncgLx/kOUIYglL0lmG7TY2gOq8ivKCpf0FLkCFqyJyBTHLwqyYo2DxbF7ej4C1xOpOR 5m1hEzTUTyicjXuqTOWUaW64dAf5MRZpbK8kPvBw6adUtqhyluxANzNwl7MgZIdgT//z Zi+Kl7BAQTVw9VDZc10MFDNjVxts5CWHjUvWP728elqvGPi7pk0IJGuOmtl9rYpi8CsS CQRw== X-Gm-Message-State: ALyK8tLrxIyTkYWGfUhcHiFX7+w3nWzxQ4D5Jdksof37iyMgI3qmIPLcB4UV63EzYCduV3rF0xZIRUzc9TMrzg== X-Received: by 10.55.200.152 with SMTP id t24mr718066qkl.197.1464911640929; Thu, 02 Jun 2016 16:54:00 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 27ov9cna9SyEvoxfcaIVCLihmB8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109390 On Thu, Jun 2, 2016 at 11:15 PM, Michael Selik wrote: > > > On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata 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