Open JordanLeich opened 3 years ago
The basic calculation doesn't let you use brackets or follow operator precedence. I'd suggest taking a input for the whole calculation and calling eval
on it. Eval does raise a risk of arbitrary code execution, but since this is only a local project it does not matter, and if it does then a regex could be run against it to only allow sensible characters. You could otherwise write a custom parser, but this is quite involved and unnecessary when python offers eval
.
@PeanutbutterWarrior Completely removed the calculator function and replaced them with eval(), same with the gui version.
Restarting the application from places other than main crashes. The cause might because main imports files where it's unknown to the file that restart is being called from.
@bot-coder05 With my version of the project, I'm not having any issues with restarting the program from other files than the main.py file, check to see if your version is the most up-to-date or try deleting the project from your computer and then git pull from the project.
@JordanLeich hmmm. If I run the calculators.py directly and not from main, when I choose to restart it gives an error
ModuleNotFoundError: No module named 'calculators.calculators'; 'calculators' is not a package
@bot-coder05 I was able to find the exact error you were talking but unfortunately, I'm not sure how to fix it, I've tried changing around the imports in the restart file but nothing works. Ideally, an end-user would not be running the project from any other file than the main.py file so they would not be capable of seeing this error message.
@JordanLeich
Ideally, an end-user would not be running the project from any other file than the main.py file so they would not be capable of seeing this error message.
I agree, it might be a mild inconvenience to developers though. We can ignore it for now as it's not affecting anyone
> python3 main.py
Traceback (most recent call last):
File "~/Ultimate-Calculator/conversions/conversions.py", line 2, in <module>
import winsound
ModuleNotFoundError: No module named 'winsound'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/Ultimate-Calculator/main.py", line 9, in <module>
import conversions.conversions
File "~/Ultimate-Calculator/conversions/conversions.py", line 5, in <module>
import winsound
ModuleNotFoundError: No module named 'winsound'
Running on MacOs.
@mbcalli Thanks for reaching out about this, I just fixed this error message for you.
@mbcalli Thanks for reaching out about this, I just fixed this error message for you.
Yes, fixed. Thank you.
When running main.exe: NameError: name 'exit' is not defined in "gui.py" line 81
Happens after choosing option 3.
When running main.exe:
NameError: name 'exit' is not defined in "gui.py" line 81
Happens after choosing option 3.
I will look into this error.
@ShawnDriscoll I have fixed the exit bug but please avoid using the GUI application while running the main.exe version since the GUI seems to be incompatible with how the main.exe file is created.
Reporting Bugs ❗
Known Bugs 🐛