Created 06-21-2017 02:19 PM
I am trying to over write the file with cp command and it failed with below error.
cp: cannot create regular file "filename" : Invalid argument
i checked the error log and got the below error.
ERROR nfs3.RpcProgramNfs3 (RpcProgramNfs3.java:setattr(436)) - Setting file size is not supported when setattr, fileId: 18463
Can some one Help me with it.
Thanks in Advance.
Created 06-23-2017 12:51 PM
Hi, cp is working with the option "-f". But when i try with python it is failing with below error.
IOError: [Errno 22] invalid mode ('wb+') or filename: '/file_path/testWrite.txt'
Can some one help with it.
Created 06-23-2017 07:38 PM
Hi Paramesh,what is the python code you are using.
Created 06-27-2017 05:10 AM
First of all thanks for your reply. I used below code with the python write mode of w,w+ and wb+.
open_file = open("/hdfs_nfs/hdfs_Data/sampledata/testWrite.txt", 'wb+') open_file.write("This is just a sample data") open_file.close()
The file "testWrite.txt" is getting created in given path (HDFS Mount point) when I run this for first time.
I am getting below error, when I execute above code from second time onwards.
IOError: [Errno 22] invalid mode ('wb+') or filename: '/hdfs_nfs/hdfs_Data/sampledata/testWrite.txt'
Created 07-05-2017 10:13 PM
@Paramesh malla, Is testWrite.txt file present on HDFS while running test code second time ? If yes, please delete /hdfs_nfs/hdfs_data/sampledata/testWrite.txt and rerun.
HDFS only supports append, so if you intend to append data after file creation, use 'a' option.
with open(filename,'a')as f: f.write(text)
Created 07-05-2017 11:38 PM
You need to overwrite file with python(like cp -f) in order to get it working.
Please refer below link:
Hope this helps.
Created 07-07-2017 11:40 AM
Thanks for the reply. I tried the method that was mentioned on above given link. still it is not working.
I am getting below error.
Traceback (most recent call last): File "write_test.py", line 7, in <module> open_file.truncate() IOError: [Errno 22] Invalid argument.