sDNA can work in Python 3! time.clock = time.perf_counter#13
Open
JamesParrott wants to merge 16 commits into
Open
sDNA can work in Python 3! time.clock = time.perf_counter#13JamesParrott wants to merge 16 commits into
JamesParrott wants to merge 16 commits into
Conversation
inpect -> inspect
…env in method Otherwise the wrong error occurs when using a zone file with an empty zone
unicode is only a built-in in Python 2. str in Python 3 supports unicode natively.
Fixes NameError that would otherwise occur in path = os.path.dirname(unicode(__file__, encoding)) in Python 3
StandardError is deprecated in Python 3. Replaced with AttributeError, ValueError and Exception
Replaced deprecated StandardErrors with AttributeError and Exception
Switch the order of these imports so we can change the code as little as possible: runcalculation imports time, but other than _parentdit the common logic across sdnaintegral, sdnaprepare as well as sdnalearn and sdnapredict is in sdnaenvironment
…n del ing them. Fixes fiftysevendegreesofrad#11 File writer objects were being relied on to close themselves. In Iron Python relying on del to call .close() or some other error meant Shapefile headers were not being written properly - this should happen in the __exit__ of the context manager but can be called in .close() if preferred. del is known to result in wierd behaviour in cPython, and it's certainly no better in Iron Python, so ought not be relied on to call .close() The curious number 960051513 that made its way into the shapefile type in the header, is 39393939 in base 16. 39 happens to be b'9'.hex(). In shapefile.Writer.__init__ long before the header is constructed properly (as the length of the file is not yet known) is the following line of code: if self.shp: self.shp.write(b'9'*100) This just reserves the 100 bytes of space required at the start of the file according to the ESRI shapefile spec.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The latest two commits are only a 6 line change so (as admin) I tracked my sDNA+ installation folder with git locally (*) and copied the only two changed files in. I was able to run integral, prepare, learn and predict to work with Python 3.9 with few problems. The other commits from Pylint from my previous PR weren't even required, probably because a lot of them are in testing code.
(*)Top tip - ignore everything that's not a Python file:
.gitignore