You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by de...@wipro.com on 2011/01/18 12:11:23 UTC

Getting contents of DFS file into Python variable | Embedding PigLatin Python

Hi All,

I want to read the contents of a small file lying on the dfs into a Python Variable. This will allow me to make some decisions on the Python Program that contains embedded PIG Statements.

The file on the DFS - "testfile.txt" is a small one, containing 2-3 lines.

testfile = "/path/in/dfs/testfile.txt"
contents = Pig.fs("cat "+testfile)
print contents


Regards,
Deepak


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com