javadr / negar-gui

Graphical User Interface for Negar -- Persian Text Editor
GNU General Public License v3.0
13 stars 2 forks source link

AttributeError when trying to debug with vscode #12

Closed ALiwoto closed 1 year ago

ALiwoto commented 1 year ago

System Information

Windows11, Vscode 1.77.0 7f329fe6c66b0f86ae1574c2911b681ad5a45d63 x64 Vscode debug config: here

Negar-gui Information

Negar-gui-v7.0 latest commit: 7e036b53d97d4ca26581fd0bc356bb65c35e9eb0

Bug details

As seen in the screenshot below, when trying to debug the code, this exception will be raised: image

Here is the full tacktrace (with real path omitted from it):

Traceback (most recent call last):
  File "negar-gui/negar_gui/main.py", line 542, in main    MainWindow = MyWindow()
                 ^^^^^^^^^^
  File "negar-gui/negar_gui/main.py", line 52, in wrapper    self.connectSlots()
  File "negar-gui/negar_gui/main.py", line 221, in connectSlots
    self.actionSave.triggered.connect(self.saveFileSlot)
    ^^^^^^^^^^^^^^^
AttributeError: 'MyWindow' object has no attribute 'actionSave'. Did you mean: 'actionPaste'?

Steps to reproduce

  1. Pull latest changes from the main branch: git pull origin main. (or clone the repo if you don't have it on local).
  2. Open the project directory with vscode (make sure you have Python Extension installed on your vscode.
  3. Go to 'Run and Debug' tab on the left side, hit on debug button.
  4. Observe the exception being raised.

If I'm doing the debugging wrongly, then we will have to correct launch.json file, so if we (or anyone else) want to debug the project with vscode, they don't have difficulty.


Expected behavior

No exception.

Actual behavior

Exception is being raised.

javadr commented 1 year ago

I have no issue. I think you have the old version of negar_gui/Ui_mwin.py. Check it and inform me about it.

ALiwoto commented 1 year ago

@javadr

I think you have the old version of negar_gui/Ui_mwin.py. Check it and inform me about it.

Nope, I just git pulled, I'm still getting the exact same error... perhaps there is something wrong on my side... Will you be at university tomorrow by any chance? (I can come at ~3:30PM).

ALiwoto commented 1 year ago

Ahh okay, I fixed the issue. I had to re-install some other dependencies which were defined inside of setup.py (and there is no way to do that besides doing pip install negar-gui (or upgrading its version). which is a bit... Isn't it possible to have a requirements.txt file at the root of our project? (So instead of doing pip install negar-gui, people who want to run the code through repo become able to install/upgrade the dependencies directly by doing pip install -r requirements.txt)

Would be really nice if we could have this file (I can also make a PR for it if you agree).

ALiwoto commented 1 year ago

Otherwise we can just close this issue.

javadr commented 1 year ago

Whenever you want to test the latest release, make sure that you've uninstalled the negar-gui via pip like pip uninstall negar-gui. If you don't do it, the program will call the libraries installed in the local Python repository, not in the pulled repo.