Class has method that shows in intellisense, but gives an error when running it
Question: I'm tring to set the default encoding of my console to UTF-8 so it can display
cyrillic letters and accented letters.

Here is my code:

    
    
    from Parser import parser
    import sys
    
    print sys.getdefaultencoding()
    sys.setdefaultencoding('utf-8')
    

Output:

    
    
    ascii
    Traceback (most recent call last):
      File "C:\Users\Sergio.Tapia\Documents\NetBeansProjects\BabylonPython\src\TestingGrounds.py", line 5, in <module>
        sys.setdefaultencoding('utf-8')
    AttributeError: 'module' object has no attribute 'setdefaultencoding'
    

The weird thing is, when pressing the '.' after sys to see what method it has,
setdefaultencoding is shown as a possible choice. Any suggestion on what to
do?


Answer: The function `sys.setdefaultencoding()` does exist but [is
removed](http://blog.ianbicking.org/illusive-setdefaultencoding.html) from
`sys`' dictionary by `site.py` itself.

On my machine, `site.py` contains the following comment:

    
    
    # Remove sys.setdefaultencoding() so that users cannot change the
    # encoding after initialization.  The test for presence is needed when
    # this module is run as a script, because this code is executed twice.
    

