Saturday, 2 August 2014

Changes in string function in python

error: <class 'AttributeError'>: 'module' object has no attribute 'strip'
Line of Error: _extraArguments = string.split(_extraArguments)

This is one of the errors i got while building sugar.
As it turns out Python3 does not support string functions from the string module anymore and Python2 discourages it too. All the functions are now methods for the string object.
So the correct way to solve the above error would be to use the split method instead of the string.split function.
Correct Code:  _extraArguments = _extraArguments.split()

These string functions are used throughout sugar in various modules so i changed these functions everywhere in most of the sugar modules to their respective methods.

No comments:

Post a Comment

Math of Intelligence : Logistic Regression

Logistic Regression Logistic Regression ¶ Some javascript to enable auto numberi...