Python bug in Windows 8--report now, or later?

Discussion in 'Python' started by Kevin Walzer, Sep 17, 2011.

  1. Kevin Walzer

    Kevin Walzer Guest

    I have been testing my Python application on the just-released developer
    preview of Windows 8 and have noted an error: the application does not
    create an app folder in the user's "application data" directory. This
    causes the app to crash on startup. Manually creating the directory
    solves the problem. Since the app uses an os.mkdir() call to create the
    directory, and since the app runs fine on Windows 7, my guess is that
    the bug lies somewhere in the interaction between Python (I'm using
    ActivePython 2.7) and Windows.

    Here's the relevant code:

    #make preferences directory if it does not exist
    def makePrefsDir(self):
    self.appdir = os.path.join(os.path.join(os.environ['APPDATA'],
    'MyApp'))
    if not os.path.exists(self.appdir):
    os.mkdir(self.appdir)

    I realize that this developer preview of Windows is still at somewhere
    between alpha- and beta-level, and it's possible things will get better.
    Should I wait to report this as a bug until Windows 8 is released, or do
    the Python developers test Python on pre-release versions of Windows?
    Kevin Walzer, Sep 17, 2011
    #1
    1. Advertising

  2. On Sat, 17 Sep 2011 14:01:47 -0400, Kevin Walzer <>
    declaimed the following in gmane.comp.python.general:

    > def makePrefsDir(self):
    > self.appdir = os.path.join(os.path.join(os.environ['APPDATA'],
    > 'MyApp'))
    > if not os.path.exists(self.appdir):
    > os.mkdir(self.appdir)
    >

    So what does
    os.environ["APPDATA"]
    return?

    And why do you have nested os.path.join() in that line?
    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
    Dennis Lee Bieber, Sep 17, 2011
    #2
    1. Advertising

  3. Kevin Walzer

    Terry Reedy Guest

    On 9/17/2011 2:01 PM, Kevin Walzer wrote:
    > I have been testing my Python application on the just-released developer
    > preview of Windows 8 and have noted an error: the application does not
    > create an app folder in the user's "application data" directory. This
    > causes the app to crash on startup. Manually creating the directory
    > solves the problem. Since the app uses an os.mkdir() call to create the
    > directory, and since the app runs fine on Windows 7, my guess is that
    > the bug lies somewhere in the interaction between Python (I'm using
    > ActivePython 2.7) and Windows.


    We need more that guesses to act. I think is premature to call this a
    'Python bug'.

    > Here's the relevant code:
    >
    > #make preferences directory if it does not exist
    > def makePrefsDir(self):
    > self.appdir = os.path.join(os.path.join(os.environ['APPDATA'], 'MyApp'))
    > if not os.path.exists(self.appdir):
    > os.mkdir(self.appdir)
    >
    > I realize that this developer preview of Windows is still at somewhere
    > between alpha- and beta-level, and it's possible things will get better.
    > Should I wait to report this as a bug until Windows 8 is released, or do
    > the Python developers test Python on pre-release versions of Windows?


    3 days ago (Sept 14) someone asked about 'Windows 8 support' on pydev
    list. The answers were 1) 2.7 and 3.2 appear to run fine on the Dev
    release (but there was no report of test suite results); 2) Python
    directly uses so little of the Win interface that problems are not
    anticipated; 3) applications might have to make Win 8 specific
    adjustments and should test before the release.

    Of course, if MS accidentally changes thinly wrapped system calls such
    as os.environ, .exists, and .makedir, there will be a problem but that
    is their bug. My impression is that they are not intentionally breaking
    such things.

    I anticipate 3.3 and some future 2.7.z will be officially supported (and
    tested) on Win 8.

    --
    Terry Jan Reedy
    Terry Reedy, Sep 17, 2011
    #3
  4. On Sun, Sep 18, 2011 at 4:01 AM, Kevin Walzer <> wrote:
    > I realize that this developer preview of Windows is still at somewhere
    > between alpha- and beta-level, and it's possible things will get better.
    > Should I wait to report this as a bug until Windows 8 is released, or do the
    > Python developers test Python on pre-release versions of Windows?


    I would consider reporting it as a bug in Windows 8, not a bug in Python.

    Chris Angelico
    Chris Angelico, Sep 17, 2011
    #4
  5. Kevin Walzer

    John Ladasky Guest

    On Sep 17, 2:20 pm, Chris Angelico <> wrote:

    > I would consider reporting it as a bug in Windows 8, not a bug in Python.
    >
    > Chris Angelico


    +1, beat me to it. :^)
    John Ladasky, Sep 18, 2011
    #5
  6. On 2011-09-17, Chris Angelico <> wrote:

    > I would consider reporting it as a bug in Windows 8, not a bug in <whatever>


    Good luck with that plan. ;)

    [I don't know anything about this particular issue, but I do know that
    when there is a bug in Windows, it's usually everyboyd else that has
    to change to work around it.]
    Grant Edwards, Sep 18, 2011
    #6
  7. On Sun, Sep 18, 2011 at 04:15:57AM +0000, Grant Edwards wrote:
    > On 2011-09-17, Chris Angelico <> wrote:
    >
    > > I would consider reporting it as a bug in Windows 8, not a bug in <whatever>

    >
    > Good luck with that plan. ;)
    >
    > [I don't know anything about this particular issue, but I do know that
    > when there is a bug in Windows, it's usually everyboyd else that has
    > to change to work around it.]
    >
    >


    Actually Microsoft usually goes out of its way to ensure backwards-
    compatibily, even when the app developer is DOING IT WRONG.
    Westley Martínez, Sep 18, 2011
    #7
  8. Kevin Walzer

    Alec Taylor Guest

    On Sun, Sep 18, 2011 at 2:40 PM, Westley Martínez <> wrote:
    > On Sun, Sep 18, 2011 at 04:15:57AM +0000, Grant Edwards wrote:
    >> On 2011-09-17, Chris Angelico <> wrote:
    >>
    >> > I would consider reporting it as a bug in Windows 8, not a bug in <whatever>

    >>
    >> Good luck with that plan.  ;)
    >>
    >> [I don't know anything about this particular issue, but I do know that
    >> when there is a bug in Windows, it's usually everyboyd else that has
    >> to change to work around it.]
    >>
    >>

    >
    > Actually Microsoft usually goes out of its way to ensure backwards-
    > compatibily, even when the app developer is DOING IT WRONG.
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >


    For those interested, Windows 8 is available here:
    http://msdn.microsoft.com/windows/apps/br229516/
    Alec Taylor, Sep 18, 2011
    #8
  9. Kevin Walzer

    Brian Curtin Guest

    On Sat, Sep 17, 2011 at 13:01, Kevin Walzer <> wrote:
    > I have been testing my Python application on the just-released developer
    > preview of Windows 8 and have noted an error: the application does not
    > create an app folder in the user's "application data" directory. This causes
    > the app to crash on startup. Manually creating the directory solves the
    > problem. Since the app uses an os.mkdir() call to create the directory, and
    > since the app runs fine on Windows 7, my guess is that the bug lies
    > somewhere in the interaction between Python (I'm using ActivePython 2.7) and
    > Windows.
    >
    > Here's the relevant code:
    >
    >    #make preferences directory if it does not exist
    >    def makePrefsDir(self):
    >        self.appdir = os.path.join(os.path.join(os.environ['APPDATA'],
    > 'MyApp'))
    >        if not os.path.exists(self.appdir):
    >            os.mkdir(self.appdir)
    >
    > I realize that this developer preview of Windows is still at somewhere
    > between alpha- and beta-level, and it's possible things will get better.
    > Should I wait to report this as a bug until Windows 8 is released, or do the
    > Python developers test Python on pre-release versions of Windows?


    First, is your application actually crashing, or does it just exit due
    to an unhandled exception? I suspect the latter, so if that's true,
    what's the exception and message?

    You said "the application does not create an app folder in the user's
    'application data' directory" -- what does this mean, or rather, what
    is the specific folder you're expecting to have? If Python can't
    create the directory but you can do it manually, there may be some
    permission or access differences new to Windows 8. What does "echo
    %APPDATA%" give you?

    I haven't installed Windows 8 yet, but I'm planning to get it up and
    running soon. If you submit issues to http://bugs.python.org,
    hopefully with specific test cases that we can run and work with,
    it'll be easier to track and fix. If you do that, add me to the nosy
    list on the issues - tracker id: brian.curtin, I'm one of the Windows
    people around there.
    Brian Curtin, Sep 19, 2011
    #9
  10. Kevin Walzer

    Andrew Berg Guest

    On 2011.09.19 09:00 AM, Brian Curtin wrote:
    > You said "the application does not create an app folder in the user's
    > 'application data' directory" -- what does this mean, or rather, what
    > is the specific folder you're expecting to have? If Python can't
    > create the directory but you can do it manually, there may be some
    > permission or access differences new to Windows 8. What does "echo
    > %APPDATA%" give you?

    I booted up the Win8 dev preview in a VM and os.environ['appdata'] gives
    me the same result it would for Windows 7. Perhaps the problem lies in
    the os.path.exists() call (that is, Win8 and Win7 react differently to
    this call). I personally would try to create the directory and then
    catch either a WindowsError (error 183) or an OSError (error 17) if the
    directory already exists. I might play around with this later and post
    some results.

    --
    CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 6.0.2
    PGP/GPG Public Key ID: 0xF88E034060A78FCB
    Andrew Berg, Sep 19, 2011
    #10
  11. Kevin Walzer

    Alec Taylor Guest

    I can confirm that os.mkdir('C:\\h') and os.path.exists('C:\\h') work
    on Windows 8 Dev x64.

    On Tue, Sep 20, 2011 at 6:40 AM, Andrew Berg <> wrote:
    > On 2011.09.19 09:00 AM, Brian Curtin wrote:
    >> You said "the application does not create an app folder in the user's
    >> 'application data' directory" -- what does this mean, or rather, what
    >> is the specific folder you're expecting to have? If Python can't
    >> create the directory but you can do it manually, there may be some
    >> permission or access differences new to Windows 8. What does "echo
    >> %APPDATA%" give you?

    > I booted up the Win8 dev preview in a VM and os.environ['appdata'] gives
    > me the same result it would for Windows 7. Perhaps the problem lies in
    > the os.path.exists() call (that is, Win8 and Win7 react differently to
    > this call). I personally would try to create the directory and then
    > catch either a WindowsError (error 183) or an OSError (error 17) if the
    > directory already exists. I might play around with this later and post
    > some results.
    >
    > --
    > CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 6.0.2
    > PGP/GPG Public Key ID: 0xF88E034060A78FCB
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    Alec Taylor, Sep 20, 2011
    #11
  12. Kevin Walzer

    Kevin Walzer Guest

    On 9/20/11 8:32 AM, Alec Taylor wrote:
    > I can confirm that os.mkdir('C:\\h') and os.path.exists('C:\\h') work
    > on Windows 8 Dev x64.


    OK--looks like I will need to do a bit more digging into my own code.
    Thanks for clarifying.

    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, Sep 20, 2011
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DarkSpy
    Replies:
    4
    Views:
    879
    tom_usenet
    Jun 27, 2003
  2. Irmen de Jong

    Python bug report on SF, what now?

    Irmen de Jong, Nov 27, 2003, in forum: Python
    Replies:
    6
    Views:
    289
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Nov 28, 2003
  3. Benjamin Arai
    Replies:
    0
    Views:
    273
    Benjamin Arai
    Feb 1, 2004
  4. Replies:
    4
    Views:
    276
  5. kakarukeys
    Replies:
    4
    Views:
    582
    kakarukeys
    Oct 10, 2009
Loading...

Share This Page