Re: [Tutor] Wading through traceback output :p:

2011-12-26 Thread Joel Goldstick
On Mon, Dec 26, 2011 at 12:04 PM, Alan Gauld  wrote:
> On 26/12/11 12:52, Thomas C. Hicks wrote:
>
>> Also appreciate the thoughts about the file name.  This is my first big
>> project and I still have much to learn.  If you can point me to a
>> discussion of file naming when there are multiple files involved in a
>> project I am game to do some reading!
>
>
> When dealing with multiple files the only p[roblem tends to e if you have
> duplicate names. In that case create separate folders (packages in Python)
> and use namespaces to kep them separate.
>
> If you have multiple versions of the same file it's probably better to keep
> separate folders for each project version. But better still is to use a
> version control tool (which does the same thing virtually with a friendly
> UI/CLI and copes with multiple versions etc).
>
> These can range from simple file based RCS to full project based control.
> Most folks these days tenmd to go with project based
> control. CVS, SVN. GIT, Mercurial are the big names for freeware.
> [MS SourceSafe, IBM ClearCase and AidedeCamp are the big commercial players
> - but they cost big bucks(apart from SourceSafe)]
>
> SVN and Mercurial would be my suggestion, GUI front ends exist for both and
> both have packages for most Linux distros. They both have web sites with
> tutorials, but whiole there are oodles of options etc there are only a few
> commands you need for normal use, especially for a single user:
>
> create,
> check out,
> check in,
> fork,
> diff,
> merge
>
> should cover it.
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

I sent this earlier but it doesn't look like it went through:

It may be that there is something different about your data with this
recent run.  I googled your error message and came up with this link:

http://groups.google.com/group/python-excel/browse_thread/thread/c717ad00c7acc848

I'm not familiar with the package, but ValueError: More than 4094 XFs
(styles) has lots of links on google.  To test my guess, would it be
possible for you to set up your application to run it on files that it
successfully worked on before?  If it won't work on them, then I'd
guess that a module may have updated.  But if it does work, then you
may have some condition in your new data that exercises your program
in a way it hasn't be exercised before that raises the exception.

The link I showed contains this little snippet:
-
On 27/09/2010 00:46, Keyton Weissinger wrote:

>  if current_value_is_date:
>  s = XFStyle()
>  s.num_format_str = 'M/D/YY'
>  export_sheet.write(row_idx, col_idx,
> current_value, s)

...and we have a winner.

Create the style *once* in your outermost part of the function and
re-used it, rather than creating a new style each and every time you
write a date cell...
-

I don't know if this situation applies to you, but maybe it will give you a clue



-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Wading through traceback output :p:

2011-12-26 Thread Alan Gauld

On 26/12/11 12:52, Thomas C. Hicks wrote:


Also appreciate the thoughts about the file name.  This is my first big
project and I still have much to learn.  If you can point me to a
discussion of file naming when there are multiple files involved in a
project I am game to do some reading!


When dealing with multiple files the only p[roblem tends to e if you 
have duplicate names. In that case create separate folders (packages in 
Python) and use namespaces to kep them separate.


If you have multiple versions of the same file it's probably better to 
keep separate folders for each project version. But better still is to 
use a version control tool (which does the same thing virtually with a 
friendly UI/CLI and copes with multiple versions etc).


These can range from simple file based RCS to full project based 
control. Most folks these days tenmd to go with project based

control. CVS, SVN. GIT, Mercurial are the big names for freeware.
[MS SourceSafe, IBM ClearCase and AidedeCamp are the big commercial 
players - but they cost big bucks(apart from SourceSafe)]


SVN and Mercurial would be my suggestion, GUI front ends exist for both 
and both have packages for most Linux distros. They both have web sites 
with tutorials, but whiole there are oodles of options etc there are 
only a few commands you need for normal use, especially for a single user:


create,
check out,
check in,
fork,
diff,
merge

should cover it.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Wading through traceback output

2011-12-26 Thread Joel Goldstick
On Mon, Dec 26, 2011 at 7:10 AM, Alan Gauld  wrote:
> On 26/12/11 11:42, Thomas C. Hicks wrote:
>
> Given it was working before and not now the obvious question is what has
> changed? It looks like you are on a Linux box so do you have automatic
> updates switched on? Or do you always just accept the recommendation to
> update?
>
> In which case try looking at the modification dates of the
> library files
>
> Also has the verion of Excel used to create the files changed?
>
> It looks like the point that the program leaves your code is here:
>
>
>>   File "./cttOverviewMain.0.03.2011.py", line 183, in writeMonthlyHeader
>>     sh.write(7,10,"# Locations",xlwt.easyxf('font: bold True'))
>
>
> So that points the finger at the xlwt module. If it has been updated has the
> format of that call changed - to a dictionary/tuple of values for example?
>
> These are all guesses but might give you a starting point.
>
>
> Incidentally cttOverviewMain.0.03.2011.py seems like a bizarre
> name for a file? I assume that's the date or somesuch? What is the thinking
> behind that?
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

It may be that there is something different about your data with this
recent run.  I googled your error message and came up with this link:

http://groups.google.com/group/python-excel/browse_thread/thread/c717ad00c7acc848

I'm not familiar with the package, but ValueError: More than 4094 XFs
(styles) has lots of links on google.  To test my guess, would it be
possible for you to set up your application to run it on files that it
successfully worked on before?  If it won't work on them, then I'd
guess that a module may have updated.  But if it does work, then you
may have some condition in your new data that exercises your program
in a way it hasn't be exercised before that raises the exception.

The link I showed contains this little snippet:
-
On 27/09/2010 00:46, Keyton Weissinger wrote:

>  if current_value_is_date:
>  s = XFStyle()
>  s.num_format_str = 'M/D/YY'
>  export_sheet.write(row_idx, col_idx,
> current_value, s)

...and we have a winner.

Create the style *once* in your outermost part of the function and
re-used it, rather than creating a new style each and every time you
write a date cell...
-

I don't know if this situation applies to you, but maybe it will give you a clue

-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Wading through traceback output :p:

2011-12-26 Thread Lie Ryan

On 12/26/2011 11:52 PM, Thomas C. Hicks wrote:

On Mon, 26 Dec 2011 07:10:45 -0500
Alan Gauld  wrote:


On 26/12/11 11:42, Thomas C. Hicks wrote:

Given it was working before and not now the obvious question is what
has changed? It looks like you are on a Linux box so do you have
automatic updates switched on? Or do you always just accept the
recommendation to update?

In which case try looking at the modification dates of the
library files

Also has the verion of Excel used to create the files changed?

It looks like the point that the program leaves your code is here:


File "./cttOverviewMain.0.03.2011.py", line 183, in
writeMonthlyHeader sh.write(7,10,"# Locations",xlwt.easyxf('font:
bold True'))


So that points the finger at the xlwt module. If it has been updated
has the format of that call changed - to a dictionary/tuple of values
for example?

These are all guesses but might give you a starting point.


Incidentally cttOverviewMain.0.03.2011.py seems like a bizarre
name for a file? I assume that's the date or somesuch? What is the
thinking behind that?



Thanks so much for the input Alan, guesses on your part are far better
than the ignorance on my part.  I do get automatic updates (though
xlwt is not part of that, OpenOffice and its xls writing is), will have
to look at that.


Many package managers keeps a history of what packages are 
installed/updated/removed. You might want to use those to find if 
OpenOffice or some other libraries had been updated since the last time 
the script worked.



Also appreciate the thoughts about the file name.  This is my first big
project and I still have much to learn.  If you can point me to a
discussion of file naming when there are multiple files involved in a
project I am game to do some reading!


Use version control, it will relieve you of versioning headache. 
Nowadays it's pretty easy to setup a DVCS like mercurial or git even for 
small projects.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Wading through traceback output :p:

2011-12-26 Thread Thomas C. Hicks
On Mon, 26 Dec 2011 07:10:45 -0500
Alan Gauld  wrote:

> On 26/12/11 11:42, Thomas C. Hicks wrote:
> 
> Given it was working before and not now the obvious question is what
> has changed? It looks like you are on a Linux box so do you have
> automatic updates switched on? Or do you always just accept the
> recommendation to update?
> 
> In which case try looking at the modification dates of the
> library files
> 
> Also has the verion of Excel used to create the files changed?
> 
> It looks like the point that the program leaves your code is here:
> 
> >File "./cttOverviewMain.0.03.2011.py", line 183, in
> > writeMonthlyHeader sh.write(7,10,"# Locations",xlwt.easyxf('font:
> > bold True'))
> 
> So that points the finger at the xlwt module. If it has been updated
> has the format of that call changed - to a dictionary/tuple of values
> for example?
> 
> These are all guesses but might give you a starting point.
> 
> 
> Incidentally cttOverviewMain.0.03.2011.py seems like a bizarre
> name for a file? I assume that's the date or somesuch? What is the 
> thinking behind that?
> 

Thanks so much for the input Alan, guesses on your part are far better
than the ignorance on my part.  I do get automatic updates (though
xlwt is not part of that, OpenOffice and its xls writing is), will have
to look at that.

Also appreciate the thoughts about the file name.  This is my first big
project and I still have much to learn.  If you can point me to a
discussion of file naming when there are multiple files involved in a
project I am game to do some reading!

thomas
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Wading through traceback output

2011-12-26 Thread Alan Gauld

On 26/12/11 11:42, Thomas C. Hicks wrote:

Given it was working before and not now the obvious question is what has 
changed? It looks like you are on a Linux box so do you have automatic 
updates switched on? Or do you always just accept the recommendation to 
update?


In which case try looking at the modification dates of the
library files

Also has the verion of Excel used to create the files changed?

It looks like the point that the program leaves your code is here:


   File "./cttOverviewMain.0.03.2011.py", line 183, in writeMonthlyHeader
 sh.write(7,10,"# Locations",xlwt.easyxf('font: bold True'))


So that points the finger at the xlwt module. If it has been updated has 
the format of that call changed - to a dictionary/tuple of values for 
example?


These are all guesses but might give you a starting point.


Incidentally cttOverviewMain.0.03.2011.py seems like a bizarre
name for a file? I assume that's the date or somesuch? What is the 
thinking behind that?


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Wading through traceback output

2011-12-26 Thread Thomas C. Hicks
I have a script that I used to be quite proud of, up until today it was
working great.  Basically it reads in a directory tree of spreadsheets,
extracts info from them then makes a new spreadsheet to output the info
to.  The spreadsheets are xls files so it uses xlrd and xlwt to manage
the data extraction and spreadsheet creation.  Today when I ran it
(after a hiatus of about 3 months) I got this output:

Traceback (most recent call last):
  File "./cttOverviewMain.0.03.2011.py", line 294, in 
monthData(searchList)
  File "./cttOverviewMain.0.03.2011.py", line 261, in monthData
writeMonthlyHeader(writeSheet)
  File "./cttOverviewMain.0.03.2011.py", line 183, in writeMonthlyHeader
sh.write(7,10,"# Locations",xlwt.easyxf('font: bold True'))
  File "/usr/local/lib/python2.6/dist-packages/xlwt/Worksheet.py", line
1003, in write self.row(r).write(c, label, style)
  File "/usr/local/lib/python2.6/dist-packages/xlwt/Row.py", line 227,
in write style_index = self.__parent_wb.add_style(style)
  File "/usr/local/lib/python2.6/dist-packages/xlwt/Workbook.py", line
303, in add_style return self.__styles.add(style)
  File "/usr/local/lib/python2.6/dist-packages/xlwt/Style.py", line 90,
in add return self._add_style(style)[1]
  File "/usr/local/lib/python2.6/dist-packages/xlwt/Style.py", line
149, in _add_style raise ValueError("More than 4094 XFs (styles)")
ValueError: More than 4094 XFs (styles)

I don't understand this very well at all - any pointers are
appreciated.  I think what it is saying is that there is a problem with
my Python libraries but this is not a problem I have ever seen before.
Is it possible the 2.6 libraries were updated in the hiatus time
causing this problem?  If so any ideas on how I can investigate fixing
this are appreciated.

thomas
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor