[IronPython] The Overloading Story, IsolatedStorage (Silverlight)
idmkid at yahoo.com
Sun Apr 5 15:50:05 CEST 2009
What is the story on overloading with IronPython? From Michael Foord's IronPython in Action p. 208:
"[Overloading] largely works seemlessly in IronPython... If IronPython gets it wrong, it's a bug and you should report it on the IronPython mailing list or the issue tracker on the IronPython CodePlex site!"
I've been recently implementing some Silverlight + IronPython and ran into trouble with IsolatedStorage. Specifically, there are overloads for the OpenFile method as follows:
OpenFile(string path, FileMode mode)
OpenFile(string path, FileMode mode, FileAccess access)
OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
In order to open the file for reading, I found that the two parameter version was inadequate:
ioStorage = IsolatedStorageFile.GetUserStoreForApplication()
ioStorage.OpenFile("foo.text", FileMode.Open) # FAIL
But passing all parameters led to success:
ioStorage.OpenFile("foo.text", FileMode.Open, FileAccess.Read, FileShare.Read) #WIN
Interestingly enough, I can succeed in writing to a file when I don't pass a FileShare parameter:
ioStorage.OpenFile("foo.text", FileMode.Append, FileAccess.Write)
I would assume there would be some issue with incompatibility with the defaults for the parameter assignment but when I use a C# project I can succeed with the stripped down calls to create a filestream in IsolatedStorage.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users