How to bypass a "version" error?

I am “reverse engineering” Open Source code and I am totally ignorant about Python.
This code runs as is, but won’t run in debug mode due to “version” problem.

The line bellow basically generates an error stating NanoVNASaver module does not exist.

from NanoVNASaver._version import version

I need this code to run in debug and really do not care about the correct value of “version”.

Could somebody please just write a few lines of code (in Python) to “fix” the problem with “version”.

I cannot simply delete it - it is used “down the line”…

YES, I do realize there may be more problems later , but I need to start somewhere.


from setuptools_scm import get_version
version = get_version(root=‘…’, relative_to=file)
except LookupError:
** from NanoVNASaver._version import version**


INFO_URL = “GitHub - NanoVNA-Saver/nanovna-saver: A tool for reading, displaying and saving data from the NanoVNA
INFO = f"""NanoVNASaver {version}

This program is licensed under the GNU General Public License version 3

See {INFO_URL} for further details.

If you can edit the source and you know what type the “version” variable is supposed to be, I would just set it to a constant value. Literally comment out the import line and add version = “foobar” in its place (next line, same indentation level).

This assumes (at least) two things:

  1. The module isn’t executing side effects on import
  2. The error you’re seeing isn’t indicative of a more fundamental problem with your import path that is just going to cause more errors later

Oh and P.S. for later, try using “triple back ticks” when pasting code, like this:

paste code here

Thanks, I just commented out some code and replaced


version = “TEST”

and it runs in both run and debug modes in PyCharm

What a stupid error…I need to fix that eventually.

I am hoping it gets posted as a new post.

I realize I am not following much of a path , but my objective was NOT to learn everything about Python - I just need a convenient way to get familiar with it. At present I can do “code hierarchy” , now I need (to acquire ) some terminology.So - is there a way to post a screenshot here ?
I can post a file , but I cannot "see what I posted " …

I can understand not wanting to learn an entire language to make one specific modification. For learning a little bit and some terminology I would still recommend the official docs: The Python Tutorial — Python 3.11.4 documentation

No need to read it top to bottom; skim the table of contents and link from there to specific sections you want to learn about.

I think sections 4 (control flow), 5 (built in data structures), 6 (modules), and 9 (classes) may give you the most quick value. You’ll want to know a little about modules and packages in particular because that will help you trace through the imports.

If you see a Python-specific term on the forums or in the docs, there is also an official glossary that is quite good: Glossary — Python 3.11.4 documentation

I can see your screenshot - looks like PyCharm? If the IDE is complaining about an import from the current package, it is probably something to do with the project configuration. I’m not very familiar with PyCharm, but there should be a way of telling PyCharm that it should look in the “src” directory for packages in addition to the default package locations.

I am finding PyCharm quite handy “rebuilding” when code gete convoluted.

I did load code2flow, it run , recognized my project as .py then it wanted .exe.Then it suggested “graphviz”, again - it loaded but then it could not " find it" , hence another dead end.

Right now I am trying to add another .py module as “window / dialog” - just to get more familiar with Python code. Having limited success, but getting there … I need to take a look at “import” next.

You are absolutely correct - I need to pick stuff as I need it instead of reading the book cover to cover.

It would help immensely if the code was commented on…


I am unable to find what

“import …” does

It is the code just once - import with ellipsis …


Is it OK to think about python " import" similar to C #include ?

import random
import sys
from pathlib import Path

from PyQt5.QtCore import Qt, QPoint, pyqtSignal, QTimer, QTime, QRect

from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QTimer, QTime, QRect
from PyQt5.QtGui import QIntValidator, QMouseEvent, QPainter, QPaintEvent, QColor, QPen
from PyQt5.QtWidgets import QApplication, QMainWindow, QMdiArea, QWidget, QPushButton, QLabel, QSlider,
QVBoxLayout, QHBoxLayout, QCheckBox, QLineEdit, QMessageBox

Traceback (most recent call last):
File “/media/nov25-1/A_RAID/PYTHON_EXAMPLES/QMDIArea_EXAMPLES/pythonProject_TEST/”, line 12, in
from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QTimer, QTime, QRect
ModuleNotFoundError: No module named ‘PyQt6’

I am having a tough time posting here …
I did this "cut and paste and now I cannot just text…

I decided to use QMDIArea code example and PyCharm refuses to find PyQtx modules. They are both - 5 and 6 - installed.

Do I have to do more in PyCharm to use these PyQtx modules ?

Please read the pinned post and make sure you understand how to post properly formatted code.

in Python 3 is the Ellipsis object; it deliberately does nothing. I have never seen one used with an import statement before, but that statement - if valid - would do nothing. You can see examples of how it is normally used here: python - What does the Ellipsis object do? - Stack Overflow

You can think of it that way, yes. They serve a similar purposes. There is a key difference, though:

  • #include directives in C are processed at build time (by the pre processor) when you compile your code. Python is interpreted, and import statements execute when you run your program. Python needs to be able to find the thing being imported and the module is executed in order to import it.
  • Because of the above, Python modules can and often do execute arbitrary setup code.
  • Imports are cached by the interpreter, so each module is run once when it is first imported. If it’s imported again the cached module is used.

Thanks, appreciate the reply.
However, since you are the ONLY person actually answering my stupid questions , I feel I have to state - I am in no way trying to overuse your kindles, but so far I have not had much success with other “participants”.

Here is my latest “problem”.

I am trying to use published examples and have run into this:

after I use

from PyQt6.QtCore import *

I get an error

from PyQt6.QtCore import *

ModuleNotFoundError: No module named ‘PyQt6’

I followed
" forum x instructions" and did try re-install PyQt6 - uninstall and install - without success.


IMHO that makes very little sense - unless it was originally installed in a different “path” / environment - which is NOT mentioned ever.

I may learn to like "coding " in Python.
The syntax has a certain sense of humor…

“…” means nothing


“import” gets cached so no "ifdef …endif " flag needed

but I already miss "block comments "…


That is what would explain it for me also - PyCharm may be looking at a different “virtual environment” than the one PyQt6 was installed into. I would check if you can configure what interpreter [1] and virtual environment the PyCharm project is using.

If the problem is that it won’t run outside PyCharm either, it may still be the same / similar problem.

The virtual environment link I gave up there ^ has lots of examples to see how to check what Python is running, if a virtual environment is being used, and so on.

It certainly does, especially coming from C/C++ :slight_smile: I’m also a fan of having keywords not and pass.

No problem, I just do this to pass the time, haha. Do take a look at the posting guide @kknechtel linked, it shows how to format code so posts are easier to read for everyone!

  1. it can be surprisingly easy to end up with multiple interpreters installed… ↩︎

Allow me to rephrase the original post.

If I want to add a class - which existing “folder” should I use ?
Or as an option (preferred ) - create a new “sub” new folder in
which existing "parent " folder?

It is a little hard to follow the existing code- it seems to be
“organized” by GUI “windows”.


Please - answer the questions (only) and justify your reply.
If you do not understand ( the questions) what I am asking - ask for
clarification or just skip your post.

This is a great way to get people to not bother wanting to help you.

1 Like

I am very reluctant to post this HERE, on this thread.

I am trying to configure my PYCharm project.

I have downloaded an example project and it is failing to find PyQtx.

My other cloned project which uses both PyQt5 and PyQt6 works just fine.

As I said elsewhere on THIS forum - I have reinstalled both PyQt5 and PyQt6. It did not solve the problem.

For those having issues with me posting verbal description of the issue I am enclosing PyCharm error message:

Traceback (most recent call last):
File “/media/nov25-1/A_RAID/PYTHON_EXAMPLES/QMDIArea_EXAMPLES/QMDIArea+Project_/”, line 10, in
from PyQt5.QtCore import *
ModuleNotFoundError: No module named ‘PyQt5’

I am asking -


guide me thru PyChar setting(s) to configure
the failing code .

I got as far as

Main menu → File-> Settings

and see no options to "add " PyQtx

Here is a screen shot of the result


project → Inspect Code

Use the option to "Install x " when "Inspect Code " is done.