Closed pateshix closed 2 years ago
Hi first of all, please mention in your issue that you're using my version of pythonizer, not the softpano version.
Also, I need to see the source code or at least the line that generated this and I'll fix it.
@pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
Here is the sdiff of the header with v0.964 and with/without -p option. Which seems to move the perllib import to the first position. Python 3.8.x is the one in use. Also perl5 is in use for legacy flows.
plxcji019> sdiff run_emx_qa.py _perllib_issue/run_emx_qa.py
import perllib,sys,os,builtins,re | import os,builtins,re,perllib,sys _str = lambda s: '' if s is None else str(s) _str = lambda s: '' if s is None else str(s) from perllib import Die from perllib import Die perllib.init_package('main') perllib.init_package('main')
#################### ####################
#################### ####################
def ReadingInput(_args): def ReadingInput(_args): global EXTRA_PROC_FILE,GenerateSP,BotMetal,runEMXonly,Out | global GenerateSP,FREQ,PROCFILE,MimMetal,runEMXonly,tmp, GenerateSP = 0 GenerateSP = 0 runEMXonly = 0 runEMXonly = 0 RunSweep = 0 RunSweep = 0 if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): if not ((INF:=perllib.open_(f"{sys.argv[1:][0]}", 'r'))): raise Die(f"Can't open {sys.argv[1:][0]}\n") raise Die(f"Can't open {sys.argv[1:][0]}\n")
while (_d:=perllib.readline(INF)): while (_d:=perllib.readline(INF)):
_d=_d.rstrip("\n") _d=_d.rstrip("\n")
if not re.search(re.compile(r'[a-z]+',re.I),_d): if not re.search(re.compile(r'[a-z]+',re.I),_d):
continue continue
if re.search(r'^#',_d): if re.search(r'^#',_d):
continue continue
_d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'^\s+',r'',_d,count=1)
_d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1)
_d = re.sub(r'\s+',r' ',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1)
tmp = perllib.Array(perllib.split(r' ',_str(_d))) tmp = perllib.Array(perllib.split(r' ',_str(_d)))
From: Joe Cool @.> Sent: Wednesday, March 16, 2022 7:18 AM To: softpano/pythonizer @.> Cc: Ateshian, PeterX Roy @.>; Mention @.> Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
@pateshixhttps://github.com/pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
— Reply to this email directly, view it on GitHubhttps://github.com/softpano/pythonizer/issues/132#issuecomment-1069179855, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX6LHCVPXF2LEFEVUJEN3DDVAHUQZANCNFSM5Q2HWKFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>
Here is the sdiff of the header with v0.964 and with/without -p option. Which seems to move the perllib import to the first position. Python 3.8.x is the one in use. Also perl5 is in use for legacy flows.
plxcji019> sdiff run_emx_qa.py _perllib_issue/run_emx_qa.py
import perllib,sys,os,builtins,re | import os,builtins,re,perllib,sys _str = lambda s: '' if s is None else str(s) _str = lambda s: '' if s is None else str(s) from perllib import Die from perllib import Die perllib.init_package('main') perllib.init_package('main')
#################### ####################
#################### ####################
def ReadingInput(_args): def ReadingInput(_args): global EXTRA_PROC_FILE,GenerateSP,BotMetal,runEMXonly,Out | global GenerateSP,FREQ,PROCFILE,MimMetal,runEMXonly,tmp, GenerateSP = 0 GenerateSP = 0 runEMXonly = 0 runEMXonly = 0 RunSweep = 0 RunSweep = 0 if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): if not ((INF:=perllib.open_(f"{sys.argv[1:][0]}", 'r'))): raise Die(f"Can't open {sys.argv[1:][0]}\n") raise Die(f"Can't open {sys.argv[1:][0]}\n")
while (_d:=perllib.readline(INF)): while (_d:=perllib.readline(INF)):
_d=_d.rstrip("\n") _d=_d.rstrip("\n")
if not re.search(re.compile(r'[a-z]+',re.I),_d): if not re.search(re.compile(r'[a-z]+',re.I),_d):
continue continue
if re.search(r'^#',_d): if re.search(r'^#',_d):
continue continue
_d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'^\s+',r'',_d,count=1)
_d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1)
_d = re.sub(r'\s+',r' ',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1)
tmp = perllib.Array(perllib.split(r' ',_str(_d))) tmp = perllib.Array(perllib.split(r' ',_str(_d)))
From: Joe Cool notifications@github.com Sent: Wednesday, March 16, 2022 7:18 AM To: softpano/pythonizer pythonizer@noreply.github.com Cc: Ateshian, PeterX Roy peterx.roy.ateshian@intel.com; Mention mention@noreply.github.com Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
@pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
-p is the default. -P turns off the use of perllib.
-joe Sent from my iPhone
On Mar 16, 2022, at 1:16 PM, Peter Roy Ateshian @.***> wrote:
Here is the sdiff of the header with v0.964 and with/without -p option. Which seems to move the perllib import to the first position. Python 3.8.x is the one in use. Also perl5 is in use for legacy flows.
plxcji019> sdiff run_emx_qa.py _perllib_issue/run_emx_qa.py
!/usr/bin/env python3 #!/usr/bin/env python3
Generated by "pythonizer -p -d 3 run_emx_qa.pl" v0.964 run | # Generated by "pythonizer -d 3 run_emx_qa.pl" v0.964 run by
Implied pythonizer options: -m # Implied pythonizer options: -m
April 5, 2019, add option to run EMX only # April 5, 2019, add option to run EMX only
import perllib,sys,os,builtins,re | import os,builtins,re,perllib,sys _str = lambda s: '' if s is None else str(s) _str = lambda s: '' if s is None else str(s) from perllib import Die from perllib import Die perllib.init_package('main') perllib.init_package('main')
#################### ####################
ReadingInput # #ReadingInput
#################### ####################
def ReadingInput(_args): def ReadingInput(args): global EXTRA_PROC_FILE,GenerateSP,BotMetal,runEMXonly,Out | global GenerateSP,FREQ,PROCFILE,MimMetal,runEMXonly,tmp, GenerateSP = 0 GenerateSP = 0 runEMXonly = 0 runEMXonly = 0 RunSweep = 0 RunSweep = 0 if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): raise Die(f"Can't open {sys.argv[1:][0]}\n") raise Die(f"Can't open {sys.argv[1:][0]}\n")
while (_d:=perllib.readline(INF)): while (_d:=perllib.readline(INF)): _d=_d.rstrip("\n") _d=_d.rstrip("\n") if not re.search(re.compile(r'[a-z]+',re.I),_d): if not re.search(re.compile(r'[a-z]+',re.I),_d): continue continue
if re.search(r'^#',_d): if re.search(r'^#',_d): continue continue _d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) tmp = perllib.Array(perllib.split(r' ',_str(_d))) tmp = perllib.Array(perllib.split(r' ',_str(_d)))
From: Joe Cool @. Sent: Wednesday, March 16, 2022 7:18 AM To: softpano/pythonizer @. Cc: Ateshian, PeterX Roy @.; Mention @. Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
@pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.
Yes – I understand -p/default.
Q1: So does the latest v0.964 pythonizer convert each perllib/perl5lib call on the fly as multiple nested perl script? Or do I need to install / import PyPl?
Some examples of perllib calls in v0.964 pythonizer Python output file:
import os,builtins,re,perllib,sys from perllib import Die perllib.initpackage('main') if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): while (_d:=perllib.readline(INF)): tmp = perllib.Array(perllib.split(r' ',_str(_d))) TEMP = perllib.Array(tmp[1:1+(len(tmp)-1)]) perllib.perl_print(f"check sweep setting: {multisweep}, exiting \n",end="") perllib.close(INF) if not ((INF:=perllib.open(TC_DEF, 'r'))): tc = perllib.Array() while (_d:=perllib.readline(INF)): tc_def = perllib.Hash() tmp = perllib.Array(perllib.split(r',',_str(_d))) tmp1 = perllib.Array(perllib.split(r'',_str(tmp[itmp]))) ## NESTed perllib calls tmp1 = perllib.Array(perllib.split(r'__',_str(tmp[itmp]))) tmp1 = perllib.Array(perllib.split(r'',str(tmp[itmp]))) perllib.close(INF) return perllib.close(INF) if not ((INF:=perllib.open(capoutfile, 'r'))): while (_d:=perllib.readline(INF)): tmp = perllib.Array(perllib.split(r' ',_str(d))) perllib.close(INF) return perllib.close(INF) if not ((OUTFILE:=perllib.open(OutputFile, 'w'))): raise Die(f"Cann't write to {OutputFile}: {perllib.OS_ERROR}\n")
From: Joe Cool @.> Sent: Wednesday, March 16, 2022 10:46 AM To: softpano/pythonizer @.> Cc: Ateshian, PeterX Roy @.>; Mention @.> Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
-p is the default. -P turns off the use of perllib.
-joe Sent from my iPhone
On Mar 16, 2022, at 1:16 PM, Peter Roy Ateshian @.<mailto:@.>> wrote:
Here is the sdiff of the header with v0.964 and with/without -p option. Which seems to move the perllib import to the first position. Python 3.8.x is the one in use. Also perl5 is in use for legacy flows.
plxcji019> sdiff run_emx_qa.py _perllib_issue/run_emx_qa.py
!/usr/bin/env python3 #!/usr/bin/env python3
Generated by "pythonizer -p -d 3 run_emx_qa.pl" v0.964 run | # Generated by "pythonizer -d 3 run_emx_qa.pl" v0.964 run by
Implied pythonizer options: -m # Implied pythonizer options: -m
April 5, 2019, add option to run EMX only # April 5, 2019, add option to run EMX only
import perllib,sys,os,builtins,re | import os,builtins,re,perllib,sys _str = lambda s: '' if s is None else str(s) _str = lambda s: '' if s is None else str(s) from perllib import Die from perllib import Die perllib.init_package('main') perllib.init_package('main')
#################### ####################
ReadingInput # #ReadingInput
#################### ####################
def ReadingInput(_args): def ReadingInput(args): global EXTRA_PROC_FILE,GenerateSP,BotMetal,runEMXonly,Out | global GenerateSP,FREQ,PROCFILE,MimMetal,runEMXonly,tmp, GenerateSP = 0 GenerateSP = 0 runEMXonly = 0 runEMXonly = 0 RunSweep = 0 RunSweep = 0 if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): raise Die(f"Can't open {sys.argv[1:][0]}\n") raise Die(f"Can't open {sys.argv[1:][0]}\n")
while (_d:=perllib.readline(INF)): while (_d:=perllib.readline(INF)): _d=_d.rstrip("\n") _d=_d.rstrip("\n") if not re.search(re.compile(r'[a-z]+',re.I),_d): if not re.search(re.compile(r'[a-z]+',re.I),_d): continue continue
if re.search(r'^#',_d): if re.search(r'^#',_d): continue continue
_d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) tmp = perllib.Array(perllib.split(r' ',_str(_d))) tmp = perllib.Array(perllib.split(r' ',_str(_d))) From: Joe Cool @.<mailto:@.> Sent: Wednesday, March 16, 2022 7:18 AM To: softpano/pythonizer @.<mailto:@.> Cc: Ateshian, PeterX Roy @.<mailto:@.>; Mention @.<mailto:@.> Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
@pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.
— Reply to this email directly, view it on GitHubhttps://github.com/softpano/pythonizer/issues/132#issuecomment-1069392916, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX6LHCVB3MM6AOZQ5WLGGL3VAIM5JANCNFSM5Q2HWKFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>
You can either set PYTHONPATH=Directory Containing Pythonizer.pm
or run
pip install perllib
FYI @pateshix I opened up the Issues and Discussions tabs on my version: https://github.com/snoopyjc/pythonizer/issues
With -p (default) you either need to
pip install perllib
-or-
export PYTHONPATH=Path to where you installed pythonizer/pythonizer
The version of perllib should match the pythonizer version you are using.
-joe Sent from my AT&T iPhone
On Mar 16, 2022, at 2:25 PM, Peter Roy Ateshian @.***> wrote:
Yes – I understand -p/default.
Q1: So does the latest v0.964 pythonizer convert each perllib/perl5lib call on the fly as multiple nested perl script? Or do I need to install / import PyPl?
Some examples of perllib calls in v0.964 pythonizer Python output file:
import os,builtins,re,perllib,sys from perllib import Die perllib.initpackage('main') if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): while (_d:=perllib.readline(INF)): tmp = perllib.Array(perllib.split(r' ',_str(_d))) TEMP = perllib.Array(tmp[1:1+(len(tmp)-1)]) perllib.perl_print(f"check sweep setting: {multisweep}, exiting \n",end="") perllib.close(INF) if not ((INF:=perllib.open(TC_DEF, 'r'))): tc = perllib.Array() while (_d:=perllib.readline(INF)): tc_def = perllib.Hash() tmp = perllib.Array(perllib.split(r',',_str(_d))) tmp1 = perllib.Array(perllib.split(r'',_str(tmp[itmp]))) ## NESTed perllib calls tmp1 = perllib.Array(perllib.split(r'__',_str(tmp[itmp]))) tmp1 = perllib.Array(perllib.split(r'',str(tmp[itmp]))) perllib.close(INF) return perllib.close(INF) if not ((INF:=perllib.open(capoutfile, 'r'))): while (_d:=perllib.readline(INF)): tmp = perllib.Array(perllib.split(r' ',_str(d))) perllib.close(INF) return perllib.close(INF) if not ((OUTFILE:=perllib.open(OutputFile, 'w'))): raise Die(f"Cann't write to {OutputFile}: {perllib.OS_ERROR}\n")
From: Joe Cool @.> Sent: Wednesday, March 16, 2022 10:46 AM To: softpano/pythonizer @.> Cc: Ateshian, PeterX Roy @.>; Mention @.> Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
-p is the default. -P turns off the use of perllib.
-joe Sent from my iPhone
On Mar 16, 2022, at 1:16 PM, Peter Roy Ateshian @.<mailto:@.>> wrote:
Here is the sdiff of the header with v0.964 and with/without -p option. Which seems to move the perllib import to the first position. Python 3.8.x is the one in use. Also perl5 is in use for legacy flows.
plxcji019> sdiff run_emx_qa.py _perllib_issue/run_emx_qa.py
!/usr/bin/env python3 #!/usr/bin/env python3
Generated by "pythonizer -p -d 3 run_emx_qa.pl" v0.964 run | # Generated by "pythonizer -d 3 run_emx_qa.pl" v0.964 run by
Implied pythonizer options: -m # Implied pythonizer options: -m
April 5, 2019, add option to run EMX only # April 5, 2019, add option to run EMX only
import perllib,sys,os,builtins,re | import os,builtins,re,perllib,sys _str = lambda s: '' if s is None else str(s) _str = lambda s: '' if s is None else str(s) from perllib import Die from perllib import Die perllib.init_package('main') perllib.init_package('main')
#################### ####################
ReadingInput # #ReadingInput
#################### ####################
def ReadingInput(_args): def ReadingInput(args): global EXTRA_PROC_FILE,GenerateSP,BotMetal,runEMXonly,Out | global GenerateSP,FREQ,PROCFILE,MimMetal,runEMXonly,tmp, GenerateSP = 0 GenerateSP = 0 runEMXonly = 0 runEMXonly = 0 RunSweep = 0 RunSweep = 0 if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): if not ((INF:=perllib.open(f"{sys.argv[1:][0]}", 'r'))): raise Die(f"Can't open {sys.argv[1:][0]}\n") raise Die(f"Can't open {sys.argv[1:][0]}\n")
while (_d:=perllib.readline(INF)): while (_d:=perllib.readline(INF)): _d=_d.rstrip("\n") _d=_d.rstrip("\n") if not re.search(re.compile(r'[a-z]+',re.I),_d): if not re.search(re.compile(r'[a-z]+',re.I),_d): continue continue
if re.search(r'^#',_d): if re.search(r'^#',_d): continue continue
_d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'^\s+',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'(\s+)$',r'',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) _d = re.sub(r'\s+',r' ',_d,count=1) tmp = perllib.Array(perllib.split(r' ',_str(_d))) tmp = perllib.Array(perllib.split(r' ',_str(_d))) From: Joe Cool @.<mailto:@.> Sent: Wednesday, March 16, 2022 7:18 AM To: softpano/pythonizer @.<mailto:@.> Cc: Ateshian, PeterX Roy @.<mailto:@.>; Mention @.<mailto:@.> Subject: Re: [softpano/pythonizer] perllib functions are are retained in pythonizer conversion - however no link/hook to process them or convert them to python import/lib (Issue #132)
@pateshix If the ^ above is pointing to the :=, then you're not using at least python 3.8, which is the minimum supported version. Also it looks like you're not using the latest version of pythonizer - it's up to v0.964.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.
— Reply to this email directly, view it on GitHubhttps://github.com/softpano/pythonizer/issues/132#issuecomment-1069392916, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX6LHCVB3MM6AOZQ5WLGGL3VAIM5JANCNFSM5Q2HWKFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>> — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.
File "C2s.py", line 15 if not ((INFILE:=perllib.open_(f"{sys.argv[1:][0]}", 'r'))): ^ SyntaxError: invalid syntax
Instructions are:
-s -- Attempt to run standard library functions thru pythonizer for use/require - not recommended! -S -- Turn off -s -p -- "import perllib" library instead of including functions inline to emulate perl built-in functions (default) -P -- Turn off -p
should this be something else for perllib. as I have many embedded in my .pl code