Getting failed to parse source file. AST error message: expression cannot contain assignment, perhaps you meant "=="? (<unknown>, line 73) even if there is no error.
The code is
async def download_episode(download_url):
anime_name = name_parser(download_url)
filename = anime_name + download_url[-4:]
make_directory(anime_name)
download_path = os.path.join(anime_name, filename)
if not os.path.exists(download_path):
await (
await asyncio.create_subprocess_shell(
f'youtube-dl "{download_url}" -o "{download_path}"',
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
).communicate()
clear_tmp(anime_name)
return download_path
Last line of code is line 74
And raises error at line 73 clear_tmp(anime_name), which is
def clear_tmp(directory):
for i in os.listdir(directory):
if i[-4:] == "part":
os.remove(os.path.join(directory, i))
Argument used was black . and after this error I changed it to black --fast . which gives no error like that.
Black version: 21.7b0
Python version: 3.9.6
Getting
failed to parse source file. AST error message: expression cannot contain assignment, perhaps you meant "=="? (<unknown>, line 73)even if there is no error.The code is
Last line of code is line 74
And raises error at line 73
clear_tmp(anime_name), which isArgument used was
black .and after this error I changed it toblack --fast .which gives no error like that.Black version: 21.7b0
Python version: 3.9.6