xlsxwriter considering worksheet.write as tuple ???

Mohan Mohta mohan.mohta at gmail.com
Mon Sep 26 21:39:44 EDT 2016


On Monday, September 26, 2016 at 8:30:34 PM UTC-5, Nathan Ernst wrote:
> There's a bug at line 362:
> 
> sup_sheet.write=(s_count,"VM", cell_format);
> ---------------^
> 
> Like I suggested, you've an errant assignment to sup_sheet.write.
> 
> Also, a couple of notes on style: the terminating semicolons in your code
> is unnecessary. It's only needed for multiple statements on a single line.
> Please use a single space on each side of a binary operator or assignment -
> it improves readability.
> 
> Regards,
> 
> On Mon, Sep 26, 2016 at 8:18 PM, Mohan Mohta <mohan.mohta at gmail.com> wrote:
> 
> > On Monday, September 26, 2016 at 8:08:13 PM UTC-5, MRAB wrote:
> > > On 2016-09-27 01:34, Mohan Mohta wrote:
> > > > On Monday, September 26, 2016 at 6:56:20 PM UTC-5, Nathan Ernst wrote:
> > > >> On Mon, Sep 26, 2016 at 6:00 PM, MRAB <python at mrabarnett.plus.com>
> > wrote:
> > > >>
> > > >> > On 2016-09-26 23:03, M2 wrote:
> > > >> >
> > > >> >> Hello
> > > >> >> The program is designed to collect different statistics from
> > servers
> > > >> >> across the network and populate in excel sheet.
> > > >> >> Library : xlsxwriter.0.9.3
> > > >> >>
> > > >> >> Below is the Snip of code being used
> > > [snip]
> > > >> >>
> > > >> >> Traceback (most recent call last):
> > > >> >>   File "./turnover_sheet.py", line 398, in <module>
> > > >> >>     data_population(str(sys.argv[1]));
> > > >> >>   File "./turnover_sheet.py", line 380, in data_population
> > > >> >>     data_collection(fqdn,count);
> > > >> >>   File "./turnover_sheet.py", line 219, in data_collection
> > > >> >>     sup_sheet.write(s_count,fqdn,cell_format);
> > > >> >> TypeError: 'tuple' object is not callable
> > > >> >>
> > > >> >> I also saw the sheet populated with the first server and when it
> > went to
> > > >> >> the second server and while populating it considered
> > > >> >> sup_sheet.write as a tuple which makes no sense because the rest
> > of the
> > > >> >> writes are working fine.
> > > >> >>
> > > >> >> I have no clue why is it doing it ?
> > > >> >> Thoughts ?
> > > >> >>
> > > >> >> I can't see a problem in the part of the code that you've posted.
> > > >> >
> > > >> > Are there any other lines that use 'sup_sheet'?
> > > >> >
> > > >> There's nothing wrong with the snippet as shown - the problem must be
> > > >> elsewhere.  I took the snippet as in the original email and made some
> > > >> slight changes to define cell_format, head and table_head & close the
> > > >> workbook:
> > > >>
> > > >> #!/usr/bin/env python
> > > [snip]
> > > >
> > > > But when it picks the second server from the list and starts doing
> > what it needs to do then for whatever reason it thinks that this is a tuple
> > > > sup_sheet.write(s_count,fqdn,cell_format);
> > > >
> > > >
> > > > Let me know if you need I can load the entire program ( if it helps )
> > > > It is just that it is a still in progress and is a 400+ lines of code.
> > > >
> > > You could post the code at Pastebin.com to avoid filling people's
> > inboxes.
> >
> > Here you go
> > http://pastebin.com/YsbV79XM
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

Dang 
that was it.
I was wondering where I was assigning it.
No wonder it was thinking sup_sheet.write as a tuple.
That was dumb.

Well as of semi colon it is just a habit from my old programming style :)

And I take your suggestion 
"Please use a single space on each side of a binary operator or assignment - 
it improves readability. "

Thanks Nathan

--
Regards
Mohan Mohta



More information about the Python-list mailing list