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

K

Kevin Walzer

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?
 
D

Dennis Lee Bieber

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?
 
T

Terry Reedy

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.
 
C

Chris Angelico

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
 
G

Grant Edwards

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.]
 
W

Westley Martínez

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.
 
A

Alec Taylor

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.

For those interested, Windows 8 is available here:
http://msdn.microsoft.com/windows/apps/br229516/
 
B

Brian Curtin

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.
 
A

Andrew Berg

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.
 
A

Alec Taylor

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

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.
 
K

Kevin Walzer

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top