Re: [Tutor] How (and whether I should) use pkgutil.get_data()?

2016-01-18 Thread Oscar Benjamin
On 17 January 2016 at 23:37, boB Stepp wrote: > 1) Is using pkgutil.get_data() the way I should be reading my data files? Generally yes, although it may be unnecessary. The main purpose of pkgutil.get_data is to transparently handle the case where your packages are

[Tutor] How (and whether I should) use pkgutil.get_data()?

2016-01-17 Thread boB Stepp
>From "Python Cookbook, 3rd Ed." by David Beazley and Brian K. Jones, the authors recommend using pkgutil.get_data() to obtain the contents of data files. Normally I would use "with open..." giving my expected file's location, but the authors claim that using pkgutil.get_data() is a more robust