Skip to main content

We are working on way to  be able to write data into universe files  directly from  python application running on the universe server that  pull data from cloud pub sub topics as we begin the process we have run into a snag, namely being unable to writer records  using u2py . here is little test program we wrote

this work complete when running this inside the python shell , however when we try running it using  unix shell it it able to read the SPF.TEST Record but then does not write the data back into the same file as new record AK.TEST2. we only find out that it fail to write bit does not throw an error when we try to read and print the new record. 

we are not sure what is missing . any help is appreciated.  

import u2py

def main():
	print("Main start")
	lp = u2py.Command('LOGTO PROD').run()
	test = u2py.File("INF.FILES")
	t_read = test.read("SPW.TEST")
	print(f"main :",t_read)
	test.write = ("AK.TEST2",t_read)
	t_read2 = test.read("AK.TEST2")
	print(f"main :",t_read2)

if __name__ == "__main__":
    main()


------------------------------
Atul kakade
Tailored Brands
------------------------------

We are working on way to  be able to write data into universe files  directly from  python application running on the universe server that  pull data from cloud pub sub topics as we begin the process we have run into a snag, namely being unable to writer records  using u2py . here is little test program we wrote

this work complete when running this inside the python shell , however when we try running it using  unix shell it it able to read the SPF.TEST Record but then does not write the data back into the same file as new record AK.TEST2. we only find out that it fail to write bit does not throw an error when we try to read and print the new record. 

we are not sure what is missing . any help is appreciated.  

import u2py

def main():
	print("Main start")
	lp = u2py.Command('LOGTO PROD').run()
	test = u2py.File("INF.FILES")
	t_read = test.read("SPW.TEST")
	print(f"main :",t_read)
	test.write = ("AK.TEST2",t_read)
	t_read2 = test.read("AK.TEST2")
	print(f"main :",t_read2)

if __name__ == "__main__":
    main()


------------------------------
Atul kakade
Tailored Brands
------------------------------

Appears to be a syntax error, change 

test.write = ("AK.TEST2",t_read)

to 

test.write("AK.TEST2", t_read)

Hope this helps.

-Dave



------------------------------
Dave Weinstein
Associate Technical Support Engineer
Rocket Internal - All Brands
------------------------------