Skip to content

Commit

Permalink
Fix error on update requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsocv12 committed May 11, 2021
1 parent 965a5b6 commit 055ad38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mmp/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit 055ad38

Please sign in to comment.