[IronPython] Please help me out its very urgent
dinov at exchange.microsoft.com
Wed Feb 13 00:51:41 CET 2008
Yeah, if it's released in 2006 it looks like it had to be 1.0 (1.1 was released in 2007) - so it's not going to have the fix.
I would suggest using ASP.NET Futures if that's possible. Unfortunately I'm not too familiar with the ASP.NET support either and our expert is currently on vacation for the next 2 weeks. I would have thought we would have released a version based upon 1.1 at some point. If we did that it should be possible to drop-in 1.1.1 over the 1.1 binaries and have everything work - but that won't work between 1.0 and 1.1 because the assembly versions are different (which was intentional because there's new public API surface in 1.1).
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Machin
Sent: Tuesday, February 12, 2008 2:50 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Please help me out its very urgent
Dino Viehland wrote:
> Can you try using the library just from the command line and see what
> the result is? You might want to try running w/ -X:ExceptionDetail to
> see where the exception is actually coming from.
> I tried and was able to open a XLS saved in Office 2003 and earlier
> format w/o any problems using this library so it's hard to know what's
> blowing up in all the code below.
I'm the author of xlrd, the library that Praveen is trying to use. I
suspect that the root cause of Praveen's problem is related to this
IronPython bug that I reported ages ago:
This now says status == closed, and release == 2.0 Alpha 5; however it
appears to be fixed in Iron Python 1.1.1. Like you, I have been able to
use xlrd OK from the 1.1.1 ipy interactive prompt. Praveen says he can
do that too. Praveen is however using "IronPython for ASP.NET" which was
evidently released on 11/3/2006 [11 March or 3 November?]. He is *not*
using the "ASP.NET Futures" released in May 2007.
Caveat: ASP, ASP.NET and "IronPython for ASP.NET" are diminishingly
scarce in my knowledge-base :-)
Am I correct in guessing that the IronPython bug is not fixed in the
2006 version of "IronPython for ASP.NET"?
I have suggested the following to Praveen:
Please try this simple test:
1. set up a test module called test1.py, containing:
print >> sys.stderr, "test 1: being imported"
2. remove all references to xlrd from your aspx.py. Instead, put in:
print >> sys.stderr, "aspx: module imported OK"
3. run that and see if it prints as expected. If print >> sys.stderr
doesn't work in IP for asp.net, find some other way of doing debug
displays. Do whatever is necessary to get test1 demonstrably importable.
4. copy the final working test1.py to test2.py, and insert a new line at
# coding: cp1252
5. change your aspx.py to import test2 instead of test1.
If that fails with "Value cannot be null. Parameter name: encoding",
then my guess that my reported bug is not fixed in IP for ASP.NET would
seem to be correct.
We can work around that.
Unfortunately this was abandoned at step 3, because the aspx.py was
missing a line containing "import sys", this caused an error message
"name 'sys' not defined", and the suggested remedy caused some further
problem of an unspecified nature.
> *From:* users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Praveen Kumar
> *Sent:* Monday, February 11, 2008 9:31 PM
> *To:* users at lists.ironpython.com
> *Subject:* [IronPython] Please help me out its very urgent
> I am new for Ironpython for ASP.net, earlier i was using only Visual
> studio 2005 and struggling with to read excel file without M$ Excel
> object, bt i could nt get any other object which could read excel sheet.
> But suddenly i got one
> Lingfo - Python "xlrd" package for extracting data from Excel files -
> 0.6.1 final
> which can read successfully excel sheet as i desired.but the problem is
> i dont knw hw can i use with IronPython Asp.net(Microsoft IronPython for
> ASP.NET <http://ASP.NET>). i have seperately installed Python2.4..
> i tried with python2.4 its working failrly.while installing xlrd it
> automatically search D:\Python24\, there were no option to configure it
> nad installed in D:\Python24\Lib\site-packages\.
> Then i copy the XLRD package and paste C:\Program Files\Microsoft
> IronPython for ASP.NET\Lib\site-packages\
Not at my suggestion :-)
> and wrote the python script ExcelModule.py
Actually it's a kludged version of a recipe from the ASPN Python
> class readexcel(object):
> def __init__(self,filename):
> """ Returns a readexcel object of the specified filename - this
> may take a little while because the file must be parsed into memory """
> import sys
> from xlrd import *
> print dir(xlrd)
This won't work because "xlrd" is not defined
> return printed
and this won't work because "printed" is not defined
> and in default.aspx.py <http://default.aspx.py>
> import System
> import clr
> from System.Data import *
> from System.Web import *
> from System.Web.UI import *
> #from IronPython.Hosting import PythonEngine
> from clr import *
> import SampleModule
> import sys
> #import SampleModule2
> #import ExcelModule
> #from ExcelModule import readexcel
> from SampleModule import SampleClass
> from SampleModule import readexcel
> if sys.version.startswith("IronPython"):
No longer true:
IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.832
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import sys; sys.version
'2.4.0 (IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.832)'
> # print >> sys.stderr, "...importing encodings"
> import encodings
Should be extend, not append ...
> #sys.path.extend([r,'C:\Program Files\Microsoft IronPython for ASP.NET
Presumably didn't (definitely won't) work because of the comma ...
> <http://ASP.NET>',r'C:\Program Files\Micrsoft IronPython for
> ASP.NET\Lib',r'C:\\Program Files\\Microsoft IronPython
> import xlrd as ebook
> book = ebook.open_workbook('D:\my.xls', encoding_override="none")
> book = xlrd.open_workbook('D:\my.xls', encoding_override="cp1252")
WARNING to casual readers: Praveen's problem relates to the use of
encoding directives (e.g. #coding: cp1252) at the top of Python source
files. The encoding_override argument above has nothing at all to do
with this problem. As documented, it is for use in the following corner
(1) the data file ("my.xls") is in pre-Excel97 format
(2) its CODEPAGE record is missing or wrong -- i.e. written by some
careless nth-party software developer ... contrary to Darwin's theory,
this is not an endangered species :-)
Users mailing list
Users at lists.ironpython.com
More information about the Ironpython-users