Ptvs: Import warning "File is saved in encoding 'Western European(Windows)'…" appears when import folder under workspace if add .py file with "New File" menu

Created on 18 Mar 2019  Â·  6Comments  Â·  Source: microsoft/PTVS

VS Version: 16.0.0 RC.3[28714.193.d16.0]
Python Tool Version: 16.0.19066.1
Repro step:

  1. Open a folder as workspace in SE
  2. Use "Right-click the folder ->Add->New File" to add a .py file named "module.py"
  3. Add a folder named "testfolder" under current workspace
  4. Use "New File" menu to add __init__.py file in "testfolder" folder
  5. Type code in __init__.py
    def FOLDER1_MSG():
    print("hello world!")
  6. Type code in module1.py
    import testfolder
    testfolder.FOLDER1_MSG()

Actual Result:
Import warning "File is saved in encoding 'Western European(Window)' which does not match default UTF-8 encoding" appear after typing code "testfolder.FOLDER1_MSG()"
Note: The waring will disappear when close and reopen "module.py" file
image

Expect Result:
It should no warning

Editor Legacy Language Support bug

Most helpful comment

@haseebuchiha, can you try to save the file as a UTF-8 encoding?

Steps:
image

image

image

All 6 comments

I have the same issue. Did you find the result good sir??

@haseebuchiha, the temporary workaround is to close and reopen the file.

I did try that and I failed. Currently there's just this line that's annoying. Otherwise everything is working fine

@haseebuchiha, can you try to save the file as a UTF-8 encoding?

Steps:
image

image

image

Oooooooo now that's a solution. Thanks mate

If the solution does not work, please reopen

Was this page helpful?
0 / 5 - 0 ratings