From 055ad389bc88f4278549f87fb4733f6174dc608a Mon Sep 17 00:00:00 2001 From: alfonsocv12 Date: Tue, 11 May 2021 16:43:34 -0600 Subject: [PATCH] Fix error on update requirements.txt --- mmp/cli/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmp/cli/main.py b/mmp/cli/main.py index 513933e..3441721 100644 --- a/mmp/cli/main.py +++ b/mmp/cli/main.py @@ -232,6 +232,7 @@ def __update_requirements(self, name: str, version=None, remove=False): ''' Function dedicated to update requirements.txt with the new lib ''' + name = name.lower().strip(' ') requirements = open('requirements.txt', 'r+') requirements_read: list = requirements.readlines() if remove: @@ -244,8 +245,9 @@ def __update_requirements(self, name: str, version=None, remove=False): f'{name}=={version}\n' ) requirements_write = ''.join(sorted(requirements_read)) - requirements.truncate(0) + requirements.seek(0) requirements.write(requirements_write) + requirements.truncate() requirements.close() def __check_lib_installed(self, lib_name: str):