Complacency Leads to Imported Modules Mix-up
I had another import crash problem. This one wasn't as bad as my earlier plunge into circular import hell. Nonetheless, it took almost a week to figure out what had gone wrong. And until I finally had the answer in hand, I didn't know if this was going to be a time-consuming super hard problem or just a trivial annoyance. It turned out to be somewhere in between.
Hindsight is of course, 20/20.
So here below is the answer in visual form:
So here below is the answer in visual form:
Shown side by side are two folders, each featuring a .venv directory containing a "Package_03" of many of my self-built modules including a vars_01, funcs_01 and funcs_02 module (click to enlarge)
It seems that my IDE (PyCharm) cobbled together a project definition (on it own? or my fault?) that mixed together modules from both directories. That caused it to report inabilities to import from one or the other of the same-named, Package_03's.
I changed the names of all the files in one of these two .venv folders by adding a unique version number, for example, funcs_01a instead of funcs_01 for my folder of older, more proven functions. That did the trick. Suddenly I'm back in business. All the imports work again. Now back to my original goal, adding speech reproduction to my lesson plans using pyttsx3 and pygame without getting "overwhelmed".
I changed the names of all the files in one of these two .venv folders by adding a unique version number, for example, funcs_01a instead of funcs_01 for my folder of older, more proven functions. That did the trick. Suddenly I'm back in business. All the imports work again. Now back to my original goal, adding speech reproduction to my lesson plans using pyttsx3 and pygame without getting "overwhelmed".


Comments
Post a Comment