[issue6342] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread Georgios Moralis

New submission from Georgios Moralis g.mwra...@gmail.com:

It returns with the following error:
UnboundLocalError: local variable 'p' referenced before assignment

Example causing this:


--- CODE FOLLOWS ---

import os

def show_cwd_list():
alpha = os.listdir(os.getcwd())
for dirnm in alpha[:]:
if os.path.isdir(os.getcwd() + os.sep + dirnm):
print(d , dirnm)
elif os.path.ismount(os.getcwd() + os.sep + dirnm):
print(m , dirnm)
elif os.path.isfile(os.getcwd() + os.sep + dirnm):
print(f , dirnm)
elif os.path.islink(os.getcwd() + os.sep + dirnm):
print(l , dirnm)
elif os.path.isabs(os.getcwd() + os.sep + dirnm):
print(a , dirnm)
return alpha

get_dirs()

--- END OF CODE ---

The definition of ismount from the ntpath.py:


--- CODE FOLLOWS (NTPATH.PY) ---
def ismount(path):
Test whether a path is a mount point (defined as root of drive)
unc, rest = splitunc(path)
seps = _get_bothseps(p)
if unc:
return rest in p[:0] + seps
p = splitdrive(path)[1]
return len(p) == 1 and p[0] in seps

--- END OF CODE ---

As it seems, variable 'p' is used before it is initialized (_get_bothseps)

--
components: Windows
messages: 89705
nosy: g.moralis
severity: normal
status: open
title: io.path.ismount  gives local variable 'p' referenced before assignment 
error on Windows versions (ntpath.py)
type: compile error
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6342] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread Jerry Chen

Jerry Chen je...@3rdengine.com added the comment:

Duplicate of http://bugs.python.org/issue5595

Fixed in r70676

--
nosy: +jcsalterego

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6342] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
dependencies: +Wrong dump of floats
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6342] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc amaur...@gmail.com:


--
dependencies: +os.path.ismount (ntpath) gives UnboundLocalError for any input 
-Wrong dump of floats

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com