Skip to content

stop using deprecated 'message' attribute#155

Merged
boegel merged 4 commits intohpcugent:masterfrom
boegel:fix_depr_message
Feb 21, 2015
Merged

stop using deprecated 'message' attribute#155
boegel merged 4 commits intohpcugent:masterfrom
boegel:fix_depr_message

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Feb 16, 2015

EasyBuild users sometimes run into this:

<prefix>vsc/utils/generaloption.py:1031: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

But there's really no reason to use `err.message anymore:

Python 2.6:

$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 05:06:49) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A():
...  pass
... 
>>> a=A()
>>> try:a.foo
... except AttributeError, err: print str(err)
... 
A instance has no attribute 'foo'

Python 2.7:

$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A():
...   pass
... 
>>> a=A()
>>> try:a.foo
... except AttributeError, err: print err.message
... 
A instance has no attribute 'foo'
>>> try:a.foo
... except AttributeError, err: print str(err)
... 
A instance has no attribute 'foo'

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 16, 2015

@stdweird: please review

@hpcugentbot
Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/216/
Test FAILed.

@hpcugentbot
Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/217/
Test PASSed.

@stdweird
Copy link
Copy Markdown
Member

@boegel how do you trigger the deprecation warning? i don't get it in 2.7.5.

wrt the PR, it's not the same so i'll have to understand what is different.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 16, 2015

@stdweird: you can trigger the issue using eb --version with Python 2.6 (I'm not seeing it with Python 2.7 either)

the change just uses str(err) basically, since it's being used to complete a template

the code I copy-pasted in the description shows that this works fine with Python 2.6 and 2.7, and that the string is 'clean', i.e. no AttributeError in the value of str(err)

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 21, 2015

@stdweird: ping on this?

@stdweird
Copy link
Copy Markdown
Member

OK for me to go in.

bump version to 2.0.3

Conflicts:
	setup.py
@hpcugentbot
Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/229/
Test PASSed.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 21, 2015

Thanks @stdweird!

boegel added a commit that referenced this pull request Feb 21, 2015
stop using deprecated 'message' attribute
@boegel boegel merged commit dd72d15 into hpcugent:master Feb 21, 2015
@boegel boegel deleted the fix_depr_message branch February 21, 2015 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants