我使用subprocess.popeninpython將檔案放入 hdfs。它在 Windows 上使用 python 準確運行cmd。但是當我使用 vscode 運行代碼時,我得到“FileNotFoundError: [Errno 2] No such file or directory: Error.
hdfs_path = os.path.join(os.sep,'mongo_import_export')
#put csv into hdfs
put = Popen(['hadoop','dfs','-put','mongo-hadoop/import_export.csv','/mongo_import_export'], stdin=PIPE,bufsize=-1)
put.communicate()
知道我的檔案import_export.csv位于代碼所在的檔案中,并且 mong-hadoop 檔案夾位于我的本地檔案中
uj5u.com熱心網友回復:
VSCode 在與本地 CMD 不同的作業目錄中運行代碼。使用要放置的檔案的絕對路徑,而不是相對路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/475626.html
上一篇:如何在perform_create中使用Validator來限制DjangoRestFramework的影像上傳大小?
