cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-801701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EJMP%2018%20%E5%A6%82%E4%BD%95%E6%89%93%E5%BC%80uft-8%E7%BC%96%E7%A0%81%E7%9A%84py%E6%96%87%E4%BB%B6%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-801701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E7%9A%84JMP%E5%B7%B2%E7%BB%8F%E8%AE%BE%E7%BD%AE%E4%B8%BA%E2%80%9Cgb2312%E2%80%9D%E3%80%82%3CBR%20%2F%3E%E5%AE%83%E4%B8%8D%E5%86%8D%E8%83%BD%E5%A4%9F%E5%83%8F%E6%89%93%E5%BC%80%20txt%20%E6%96%87%E4%BB%B6%E9%82%A3%E6%A0%B7%E9%80%89%E6%8B%A9%E7%BC%96%E7%A0%81%E6%9D%A5%E6%89%93%E5%BC%80%E6%AD%A4%20PY%20%E6%96%87%E4%BB%B6%E3%80%82%3CBR%20%2F%3E%E5%B9%B6%E4%B8%94%20JMP%20%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E8%BF%90%E8%A1%8C%E6%AD%A4%20PY%20%E4%BB%A3%E7%A0%81%E3%80%82%3CBR%20%2F%3E%E6%88%91%E4%B8%8D%E6%83%B3%E5%B0%86%20JMP%20%E8%AE%BE%E7%BD%AE%E4%B8%BA%E2%80%9Cutf-8%E2%80%9D%E3%80%82%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222024-09-25_18-01-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222024-09-25_18-01-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222024-09-25_18-01-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222024-09-25_18-01-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F68562i1529F977CDDE7482%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222024-09-25_18-01-08.png%22%20alt%3D%222024-09-25_18-01-08.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-801701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3E%E8%87%AA%E5%8A%A8%E5%8C%96%E5%92%8C%E8%84%9A%E6%9C%AC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E8%A7%86%E7%AA%97%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-801712%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9AJMP%2018%20%E5%A6%82%E4%BD%95%E6%89%93%E5%BC%80uft-8%E7%BC%96%E7%A0%81%E7%9A%84py%E6%96%87%E4%BB%B6%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-801712%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E4%B9%9F%E6%83%B3%E7%94%A8%E8%BF%99%E4%B8%AA%E9%80%89%E9%A1%B9%E6%89%93%E5%BC%80%20py%20%E6%96%87%E4%BB%B6%E3%80%82%3CBR%20%2F%3E%E8%B0%A2%E8%B0%A2%E4%B8%93%E5%AE%B6%EF%BC%81%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222024-09-25_18-25-26.png%22%20style%3D%22width%3A%20742px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222024-09-25_18-25-26.png%22%20style%3D%22width%3A%20742px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222024-09-25_18-25-26.png%22%20style%3D%22width%3A%20742px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F68563iCB7BBEC0E9A4D2CC%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222024-09-25_18-25-26.png%22%20alt%3D%222024-09-25_18-25-26.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-802131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9AJMP%2018%20%E5%A6%82%E4%BD%95%E6%89%93%E5%BC%80uft-8%E7%BC%96%E7%A0%81%E7%9A%84py%E6%96%87%E4%BB%B6%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EJMP%20%E4%B8%93%E9%97%A8%E5%B0%86%20Python%20%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B8%BA%20UTF-8%E3%80%82%E6%82%A8%E5%8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%8B%20Python%20%E8%84%9A%E6%9C%AC%E6%9D%A5%E8%AE%BE%E7%BD%AE%E7%8E%AF%E5%A2%83%E3%80%82%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CP%3E%E8%AF%B7%E5%8F%82%E9%98%85%EF%BC%9A%20%3CA%20href%3D%22https%3A%2F%2Fpeps.python.org%2Fpep-0263%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpeps.python.org%2Fpep-0263%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E5%A6%82%E6%9E%9C%E6%B2%A1%E6%9C%89%E7%BB%99%E5%87%BA%E5%85%B6%E4%BB%96%E7%BC%96%E7%A0%81%E6%8F%90%E7%A4%BA%EF%BC%8CPython%20%E5%B0%86%E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A8%20ASCII%20%E4%BD%9C%E4%B8%BA%E6%A0%87%E5%87%86%E7%BC%96%E7%A0%81%E3%80%82%3C%2FP%3E%0A%3CP%3E%E8%A6%81%E5%AE%9A%E4%B9%89%E6%BA%90%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%EF%BC%8C%E5%BF%85%E9%A1%BB%E5%B0%86%E9%AD%94%E6%9C%AF%E6%B3%A8%E9%87%8A%E6%94%BE%E5%85%A5%E6%BA%90%E6%96%87%E4%BB%B6%E4%B8%AD%EF%BC%8C%E4%BD%9C%E4%B8%BA%E6%96%87%E4%BB%B6%E7%9A%84%E7%AC%AC%E4%B8%80%E8%A1%8C%E6%88%96%E7%AC%AC%E4%BA%8C%E8%A1%8C%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight-default%20notranslate%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%3E%3CSPAN%20class%3D%22c1%22%3E%23%20coding%3D%3CENCODING%20name%3D%22%22%3E%3C%2FENCODING%3E%3C%2FSPAN%3E%0A%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%E6%88%96%EF%BC%88%E4%BD%BF%E7%94%A8%E6%B5%81%E8%A1%8C%E7%BC%96%E8%BE%91%E5%99%A8%E8%AF%86%E5%88%AB%E7%9A%84%E6%A0%BC%E5%BC%8F%EF%BC%89%EF%BC%9A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight-default%20notranslate%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%3E%3CSPAN%20class%3D%22ch%22%3E%23!%2Fusr%2Fbin%2Fpython%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22c1%22%3E%23%20-*-%20coding%3A%20%3CENCODING%20name%3D%22%22%3E%20-*-%3C%2FENCODING%3E%3C%2FSPAN%3E%0A%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%E6%88%96%E8%80%85%EF%BC%9A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight-default%20notranslate%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%3E%3CSPAN%20class%3D%22ch%22%3E%23!%2Fusr%2Fbin%2Fpython%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22c1%22%3E%23%20vim%3A%20set%20fileencoding%3D%3CENCODING%20name%3D%22%22%3E%20%3A%3C%2FENCODING%3E%3C%2FSPAN%3E%0A%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%E6%9B%B4%E5%87%86%E7%A1%AE%E5%9C%B0%E8%AF%B4%EF%BC%8C%E7%AC%AC%E4%B8%80%E8%A1%8C%E6%88%96%E7%AC%AC%E4%BA%8C%E8%A1%8C%E5%BF%85%E9%A1%BB%E4%B8%8E%E4%BB%A5%E4%B8%8B%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%8C%B9%E9%85%8D%EF%BC%9A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight-default%20notranslate%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%3E%3CSPAN%20class%3D%22o%22%3E%5E%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%5B%3C%2FSPAN%3E%20%5C%3CSPAN%20class%3D%22n%22%3Et%3C%2FSPAN%3E%5C%3CSPAN%20class%3D%22n%22%3Ef%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22o%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22c1%22%3E%23.*%3Fcoding%5B%3A%3D%5D%5B%20%5Ct%5D*(%5B-_.a-zA-Z0-9%5D%2B)%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%E5%A6%82%E6%9E%9C%E6%AD%A4%E6%96%B9%E6%B3%95%E6%97%A0%E6%B3%95%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98%EF%BC%8C%E8%AF%B7%E8%81%94%E7%B3%BB%20JMP%20%E6%8A%80%E6%9C%AF%E6%94%AF%E6%8C%81%E5%B9%B6%E6%8F%90%E4%BA%A4%E9%94%99%E8%AF%AF%E6%8A%A5%E5%91%8A%E3%80%82%E6%88%91%E4%BC%9A%E8%A6%81%E6%B1%82%E6%88%91%E4%BB%AC%E7%9A%84%E6%B5%8B%E8%AF%95%E5%9B%A2%E9%98%9F%E6%A3%80%E6%9F%A5%20JMP%20%E4%BD%BF%E7%94%A8%E7%9A%84%E7%BC%96%E7%A0%81%E4%B8%8D%E6%98%AF%20UTF-8%20%E7%9A%84%E5%8F%98%E4%BD%93%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
lala
Level VIII

JMP 18 How to open uft-8 encoded py files?

My JMP is already set to "gb2312".
It can no longer choose the encoding to open this PY file the way it would open a txt file.
And JMP does not run this PY code correctly.
I don't want to set JMP to "utf-8".

 

Thanks!

2024-09-25_18-01-08.png

2 REPLIES 2
lala
Level VIII

Re: JMP 18 How to open uft-8 encoded py files?

I want to open py files with this option as well.
Thanks Experts!

2024-09-25_18-25-26.png

Re: JMP 18 How to open uft-8 encoded py files?

JMP specifically initializes Python as UTF-8.  You can try the standard Python mechanism for specifying the encoding of the Python source, by a 'magic comment' in the source.  However, since JMP initializes Python only once per run of JMP I'm not sure that this technique below will work.  If it does work, it would have to be the very first script run, but even that may be too late as JMP internally runs some small Python scripts to set up the environment. 

 

See: https://peps.python.org/pep-0263/

Python will default to ASCII as standard encoding if no other encoding hints are given.

To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file, such as:

# coding=<encoding name>

or (using formats recognized by popular editors):

#!/usr/bin/python
# -*- coding: <encoding name> -*-

or:

#!/usr/bin/python
# vim: set fileencoding=<encoding name> :

More precisely, the first or second line must match the following regular expression:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

If this does not solve the issue, please contact JMP Technical Support and file a bug report.  I will ask our testing team to check out variations where JMP encoding used is not UTF-8.