mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Replace os.error with OSError in tkinter and IDLE
This commit is contained in:
parent
69d03c4799
commit
786fbd8db7
6 changed files with 8 additions and 8 deletions
|
@ -103,7 +103,7 @@ class FileList:
|
||||||
if not os.path.isabs(filename):
|
if not os.path.isabs(filename):
|
||||||
try:
|
try:
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
except os.error:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
filename = os.path.join(pwd, filename)
|
filename = os.path.join(pwd, filename)
|
||||||
|
|
|
@ -110,7 +110,7 @@ class GrepDialog(SearchDialogBase):
|
||||||
def findfiles(self, dir, base, rec):
|
def findfiles(self, dir, base, rec):
|
||||||
try:
|
try:
|
||||||
names = os.listdir(dir or os.curdir)
|
names = os.listdir(dir or os.curdir)
|
||||||
except os.error as msg:
|
except OSError as msg:
|
||||||
print(msg)
|
print(msg)
|
||||||
return []
|
return []
|
||||||
list = []
|
list = []
|
||||||
|
|
|
@ -503,7 +503,7 @@ class IOBinding:
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
except os.error:
|
except OSError:
|
||||||
pwd = ""
|
pwd = ""
|
||||||
return pwd, ""
|
return pwd, ""
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class DirBrowserTreeItem(TreeItem):
|
||||||
def GetSubList(self):
|
def GetSubList(self):
|
||||||
try:
|
try:
|
||||||
names = os.listdir(self.dir or os.curdir)
|
names = os.listdir(self.dir or os.curdir)
|
||||||
except os.error:
|
except OSError:
|
||||||
return []
|
return []
|
||||||
packages = []
|
packages = []
|
||||||
for name in names:
|
for name in names:
|
||||||
|
|
|
@ -382,7 +382,7 @@ class FileTreeItem(TreeItem):
|
||||||
try:
|
try:
|
||||||
os.rename(self.path, newpath)
|
os.rename(self.path, newpath)
|
||||||
self.path = newpath
|
self.path = newpath
|
||||||
except os.error:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetIconName(self):
|
def GetIconName(self):
|
||||||
|
@ -395,7 +395,7 @@ class FileTreeItem(TreeItem):
|
||||||
def GetSubList(self):
|
def GetSubList(self):
|
||||||
try:
|
try:
|
||||||
names = os.listdir(self.path)
|
names = os.listdir(self.path)
|
||||||
except os.error:
|
except OSError:
|
||||||
return []
|
return []
|
||||||
names.sort(key = os.path.normcase)
|
names.sort(key = os.path.normcase)
|
||||||
sublist = []
|
sublist = []
|
||||||
|
|
|
@ -166,7 +166,7 @@ class FileDialog:
|
||||||
dir, pat = self.get_filter()
|
dir, pat = self.get_filter()
|
||||||
try:
|
try:
|
||||||
names = os.listdir(dir)
|
names = os.listdir(dir)
|
||||||
except os.error:
|
except OSError:
|
||||||
self.master.bell()
|
self.master.bell()
|
||||||
return
|
return
|
||||||
self.directory = dir
|
self.directory = dir
|
||||||
|
@ -209,7 +209,7 @@ class FileDialog:
|
||||||
if not os.path.isabs(dir):
|
if not os.path.isabs(dir):
|
||||||
try:
|
try:
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
except os.error:
|
except OSError:
|
||||||
pwd = None
|
pwd = None
|
||||||
if pwd:
|
if pwd:
|
||||||
dir = os.path.join(pwd, dir)
|
dir = os.path.join(pwd, dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue