Sublime Forum

Build system can’t be built

#1

I want to print one table from one Chinese website I use python3 on mac, my program is :

import pandas as pd fiddy_states = pd.read_html(‘http://baike.baidu.com/link?url=egtq5T9VHlXrxzdeXhVZZWY3NBnz4Njf_Glbb4fXm7o96R-spULpI6MOmaLibK4D-uTxG3h8Da6nxuZnKFF2lD3oGkWi4JXGZxScOKr_tWe’) print(fiddy_states[0])

first time,I use sublime text and it told me the following error:

UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 14-16

but when I tried on python IDLE, there is no error on my program .

so the problem must come from sublime text, someone suggest amend the build system with

“env”: {“PYTHONIOENCODING”: “utf8”}

but I can’t change the build, sublime don’t let me to run the program, even to save it:

0 Likes

#2

The build system in your screen shot is not valid JSON, that’s why the env part is showing up as red.

Partly that’s because the "selector" line doesn’t have a comma at the end of it, so the parser is mad that there is something other than a } following, and partly it’s because you were told to add "env": {"PYTHONIOENCODING": "utf8"} and you just added env.

You probably want the whole build system to look something like:

{
    "shell_cmd": "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env": {"PYTHONIOENCODING": "utf-8"},
}
1 Like