args and kargs in python 2.7 wxpython 3.0 win10

There are two scripts, one calls another scripts with arguments and another will display a form using received argument. The second script display a form ok, but there is no argument received. I am puzzling this is due to windows 10 (not linux). I have tested the second scripts via command line but the result is the same, no argument gets into the script.
Here are two scripts snippet:

python 2.7.14 wxPython3.0.2.0-py27 win 10

sy0000.py calling sy0001.py

				def CallPGM( self, event ):

					lstParms = ['python', 'sy0001.py']

					dctParms = {"pgm_version_id": "ver0000"}

					lstArgs = ['ver0000', 'noby']

		#			os.system("python sy0001.py " + "ver0000")    # works but args not transfered

		#			strParms = "python sy0001.py " + "ver0000"

		#			os.system(strParms)

	#	#			subprocess.Popen(lstParms + lstArgs)    # works but args not transfered

	#	#			subprocess.Popen('python', 'sy0001.py', 'abcd', 'ver0000', 'noby')  # buffer size error

		#			subprocess.Popen(['python', 'sy0001.py', 'abcd', 'ver0000', 'noby'])  # works but args not transfered

		#			subprocess.call(lstParms + lstArgs)

					subprocess.call(['python', 'sy0001.py', 'abcd', 'ver0000', 'noby'])  # works but args not transfered

	#				subprocess.call('python', 'sy0001.py', 'abcd', 'ver0000', 'noby')  buffer size error

sy0001.py called by sy0000.py

					import wx

			class MyFrame( wx.Frame ):

				def __init__( self, parm1, *args, **kargs ):

					wx.Frame.__init__ ( self, parm1, id = wx.ID_ANY, title = u"BioInformatics", pos = wx.DefaultPosition, size = wx.Size( 1200,700 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL, *args, **kargs )

					print "sy0001 init "

					print args

					print "==ok="

					print kargs

					print "==2ok="

					print parm1

					print "==parm1ok="

			app = wx.App(False)

			frame = MyFrame(None)

			frame.Show(True)

			#start the applications

			app.MainLoop()

The result after print (all testing methods):

sy0001 init

()

==ok==

{}

==2ok==

None

==parm1ok=

I have tested several calling methods as shown above with # (stated the result after the script)

Via command line

I entered python sy0001.py ver0000. The result is the same as above. Can somebody advise me what I am doing wrong. Or I also puzzling if this problem resides only with win10

ps I must stay versions of python and wxpython as they are due to running some other external function.

IIUC, it looks like you are expecting the command-line arguments to be passed into MyFrame.init in *args and/or **kargs. That is not how it works, command-line args are available in Python’s sys.argv list.

–Robin

···

On Thursday, May 10, 2018 at 8:00:52 PM UTC-7, jaxonnoby@yahoo.co.jp wrote:

There are two scripts, one calls another scripts with arguments and another will display a form using received argument. The second script display a form ok, but there is no argument received. I am puzzling this is due to windows 10 (not linux). I have tested the second scripts via command line but the result is the same, no argument gets into the script.
Here are two scripts snippet:

python 2.7.14 wxPython3.0.2.0-py27 win 10

sy0000.py calling sy0001.py

  			def CallPGM( self, event ):
  				lstParms = ['python', 'sy0001.py']
  				dctParms = {"pgm_version_id": "ver0000"}
  				lstArgs = ['ver0000', 'noby']
  	#			os.system("python sy0001.py " + "ver0000")    # works but args not transfered
  	#			strParms = "python sy0001.py " + "ver0000"
  	#			os.system(strParms)
  #	#			subprocess.Popen(lstParms + lstArgs)    # works but args not transfered
  #	#			subprocess.Popen('python', 'sy0001.py', 'abcd', 'ver0000', 'noby')  # buffer size error
  	#			subprocess.Popen(['python', 'sy0001.py', 'abcd', 'ver0000', 'noby'])  # works but args not transfered
  	#			subprocess.call(lstParms + lstArgs)
  				subprocess.call(['python', 'sy0001.py', 'abcd', 'ver0000', 'noby'])  # works but args not transfered
  #				subprocess.call('python', 'sy0001.py', 'abcd', 'ver0000', 'noby')  buffer size error

sy0001.py called by sy0000.py

  				import wx
  		class MyFrame( wx.Frame ):
  			def __init__( self, parm1, *args, **kargs ):
  				wx.Frame.__init__ ( self, parm1, id = wx.ID_ANY, title = u"BioInformatics", pos = wx.DefaultPosition, size = wx.Size( 1200,700 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL, *args, **kargs )
  				print "sy0001 init "
  				print args
  				print "==ok="
  				print kargs
  				print "==2ok="
  				print parm1
  				print "==parm1ok="
  		app = wx.App(False)
  		frame = MyFrame(None)
  		frame.Show(True)
  		#start the applications
  		app.MainLoop()

The result after print (all testing methods):

sy0001 init

()

==ok==

{}

==2ok==

None

==parm1ok=

I have tested several calling methods as shown above with # (stated the result after the script)

Via command line

I entered python sy0001.py ver0000. The result is the same as above. Can somebody advise me what I am doing wrong. Or I also puzzling if this problem resides only with win10

ps I must stay versions of python and wxpython as they are due to running some other external function.