简体   繁体   中英

Create directory using pytest fixture

I want to save my log files locally under '/tmp/' under a new created folder '/new_folder/' So what i did is :

subdir = tmpdir.mkdir("new_folder")

subprocess.call("adb pull /SDcard/log/ {}".format(subdir), shell=True)

But the function fails with this error : TypeError: sequence item 5: expected string, LocalPath found

Could you please help me to fix this issue

mkdir returns object of the type py._path.local.LocalPath . Convert it to string first like this:

subdir = tmpdir.mkdir("new_folder")
subprocess.call("adb pull /SDcard/log/ {}".format(str(subdir)), shell=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM