[Mono-bugs] [Bug 78904][Wis] New - IronPython1.0beta9 raises NotImplementedError: The requested feature is not implemented on os.stat call for non existant file

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jul 20 05:52:52 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mark.john.rees at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78904

--- shadow/78904	2006-07-20 05:52:52.000000000 -0400
+++ shadow/78904.tmp.26352	2006-07-20 05:52:52.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 78904
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: Ubuntu 6.06
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: mark.john.rees at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: IronPython1.0beta9 raises NotImplementedError: The requested feature is not implemented on os.stat call for non existant file
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+When running IronPython 1.0 beta 9 on 1.1.16.1 runtime, making a call to
+os.stat on a file that does not exist raises the following exception:
+"NotImplementedError: The requested feature is not implemented"
+
+
+Steps to reproduce the problem:
+1. mono ipy.exe
+2. Enter the following:
+   import os
+   os.stat("file-that-doesnot-exist")
+ 
+
+Actual Results:
+Traceback (most recent call last):
+NotImplementedError: The requested feature is not implemented.
+
+Expected Results:
+Traceback (most recent call last):
+...
+OSError: file does not exist
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+The same python code runs correctly with IPbeta9 and .NET 2
+It looks like the IOException raised in IronPython/Modules/nt.cs is not
+being handled correctly by mono runtime.
+
+snip from nt.cs:
+
+        [PythonName("stat")]
+        public static object GetFileStats(string path) {
+            StatResult sr = new StatResult();
+
+            try {
+                sr.atime =
+(long)Directory.GetLastAccessTime(path).Subtract(DateTime.MinValue).TotalSeconds;
+                sr.ctime =
+(long)Directory.GetCreationTime(path).Subtract(DateTime.MinValue).TotalSeconds;
+                sr.mtime =
+(long)Directory.GetLastWriteTime(path).Subtract(DateTime.MinValue).TotalSeconds;
+
+                if (Directory.Exists(path)) {
+                    sr.mode = 0x4000;
+                } else if (File.Exists(path)) {
+                    FileInfo fi = new FileInfo(path);
+                    sr.size = fi.Length;
+                    sr.mode = 0x8000; //@TODO - Set other valid mode types
+(S_IFCHR, S_IFBLK, S_IFIFO, S_IFLNK, S_IFSOCK) (to the degree that they apply)
+                } else {
+                    throw new IOException("file does not exist");
+                }
+            } catch (Exception e) {
+                throw ToPythonException(e);
+            }
+
+            return sr;
+        }


More information about the mono-bugs mailing list