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%20Come%20aprire%20i%20file%20py%20codificati%20uft-8%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-801701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIl%20mio%20JMP%20%C3%A8%20gi%C3%A0%20impostato%20su%20%22gb2312%22.%3CBR%20%2F%3E%20Non%20%C3%A8%20pi%C3%B9%20possibile%20scegliere%20la%20codifica%20per%20aprire%20questo%20file%20PY%20nello%20stesso%20modo%20in%20cui%20si%20aprirebbe%20un%20file%20txt.%3CBR%20%2F%3E%20E%20JMP%20non%20esegue%20correttamente%20questo%20codice%20PY.%3CBR%20%2F%3E%20Non%20voglio%20impostare%20JMP%20su%20%22utf-8%22.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3EGrazie!%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%3EAutomazione%20e%20scripting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFinestre%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%3ERe%3A%20JMP%2018%20Come%20aprire%20i%20file%20py%20codificati%20uft-8%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-801712%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EVoglio%20aprire%20anche%20i%20file%20py%20con%20questa%20opzione.%3CBR%20%2F%3E%20Grazie%20Esperti!%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%3ERe%3A%20JMP%2018%20Come%20aprire%20i%20file%20py%20codificati%20uft-8%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802131%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EJMP%20inizializza%20Python%20in%20modo%20specifico%20come%20UTF-8.%20Puoi%20provare%20il%20meccanismo%20Python%20standard%20per%20specificare%20la%20codifica%20della%20sorgente%20Python%2C%20tramite%20un%20%22commento%20magico%22%20nella%20sorgente.%20Tuttavia%2C%20poich%C3%A9%20JMP%20inizializza%20Python%20solo%20una%20volta%20per%20esecuzione%20di%20JMP%2C%20non%20sono%20sicuro%20che%20questa%20tecnica%20di%20seguito%20funzioner%C3%A0.%20Se%20funziona%2C%20dovrebbe%20essere%20il%20primo%20script%20eseguito%2C%20ma%20anche%20quello%20potrebbe%20essere%20troppo%20tardi%20poich%C3%A9%20JMP%20esegue%20internamente%20alcuni%20piccoli%20script%20Python%20per%20impostare%20l'ambiente.%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CP%3EVedere%3A%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%3EPython%20utilizzer%C3%A0%20per%20impostazione%20predefinita%20la%20codifica%20ASCII%20come%20standard%2C%20se%20non%20vengono%20forniti%20altri%20suggerimenti%20sulla%20codifica.%3C%2FP%3E%0A%3CP%3EPer%20definire%20una%20codifica%20del%20codice%20sorgente%2C%20%C3%A8%20necessario%20inserire%20un%20commento%20magico%20nei%20file%20sorgente%20come%20prima%20o%20seconda%20riga%20del%20file%2C%20ad%20esempio%3A%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%3Eoppure%20(utilizzando%20formati%20riconosciuti%20dagli%20editor%20pi%C3%B9%20diffusi)%3A%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%3EO%3A%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%3EPi%C3%B9%20precisamente%2C%20la%20prima%20o%20la%20seconda%20riga%20devono%20corrispondere%20alla%20seguente%20espressione%20regolare%3A%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%3ESe%20questo%20non%20risolve%20il%20problema%2C%20contatta%20il%20Supporto%20Tecnico%20JMP%20e%20segnala%20un%20bug.%20Chieder%C3%B2%20al%20nostro%20team%20di%20testing%20di%20controllare%20le%20varianti%20in%20cui%20la%20codifica%20JMP%20utilizzata%20non%20%C3%A8%20UTF-8.%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.