[Reprint] Sublime text 2 debug Python results blank

Source: Internet
Author: User
Tags sublime text



Everything was all right before it was used, and suddenly the problem arose today. According to ctrl+b execution time results only blank, check a lot of articles are only mentioned in Chinese path, system path and so on, did not solve the problem until you see this article: http://384444165.iteye.com/blog/1798107



The article mentions that Sublime Text 2 ctrl+b If it appears to run as blank, press CTRL + ' to display errors if the error is unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xc0 in posit Ion 9:ordinal not in range (128), then it is the same as the situation I encountered.



The cause of this problem is that the exec.py in the Packages\default directory under the profile directory is editing environment variables, but the character set in the environment variable is missing the ASCII character set.



Here's how to fix it:



Locate the Profile directory location (in sublime text 2, preference, browse Packages) to find exec.py, edit in the default directory;



Find the following two lines:


 
 for k, v in proc_env.iteritems():
            proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())





  
Change to:


 
 for k, v in proc_env.iteritems(): try:
                proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
            except UnicodeDecodeError:
                print("Encoding error")
                print("VARIABLE: ", k, " : ", v)








will be able to solve the problem.



[Reprint] Sublime text 2 debug Python results blank


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.