954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

WARNING *** format u'"*"' produces constant result

i'm reading a an excel file with xlrd. When i'm running the code a warning pops up:
'WARNING *** format u'"*"' produces constant result '

I think that u'"*"' stands for unicode, is that correct?

But what does 'produces constant result' mean and what implications can it have?

Thanks

daanh
Newbie Poster
3 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

I think that '*' is wath is causing the warning.

Could we get some code. lol :)

Beat_Slayer
Posting Pro in Training
405 posts since Jun 2010
Reputation Points: 30
Solved Threads: 105
 

>>> import xlrd
>>> wb = xlrd.open_workbook('input_rc.xls')
WARNING *** format u'"*"' produces constant result
>>> sh1 = wb.sheet_by_index(1)
>>> ordervol = []
>>> machine = []
>>> for rownum in range(sh1.nrows):
cell = sh1.cell_value(rownum, 7)
if cell == 'Sector Verf':
ordervol.append(float(sh1.cell_value(rownum, 11)))
machine.append(str(sh1.cell_value(rownum, 14)))
>>> ordervol[34:40]
[1.5, 6.0, 7.0, 3.0, 8.0, 13.5]
>>> machine[34:40]
['ETL', 'ETL', 'ETL', 'ETL', '0.0', '0.0']

This is the code I use and an example of the data in the columns that I want to obtain. I must note that the excel file is big; 60000 rows!

daanh
Newbie Poster
3 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

Apparently, it comes from a function in a file named formatting.py in xlrd source, wihch tests wether a string is a date formatting string. I think you should ignore the warning.

Gribouillis
Posting Maven
Moderator
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
 

@gribouillis thank you for the answer, but how did you figure it out?

daanh
Newbie Poster
3 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 
@gribouillis thank you for the answer, but how did you figure it out?


I wrote excel warning format produces constant result in google's search form and in the 2nd page of google results, there was this link http://nullege.com/codes/show/src@xlrd-0.7.1@xlrd@formatting.py/33/struct.unpack which points to a version of xlrd's source code, which contains the line fprintf(book.logfile,
"WARNING *** format %r produces constant result\n",
fmt)

:)

Gribouillis
Posting Maven
Moderator
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: