so the problem is that pypi.org hase been filtered by iranian government(yes , i know it’s ridiculous!). i tried to install some python modules from Github downloaded files: pip install moduleName but every module has it’s own dependencies and try to connect to pipy.org to reach them. then there will be an error during installation. is there any solution? your
Tag: module
How to resolve mutual dependencies between a main script and submodules needing access to a global variable from the script?
I’m building a Typer app with lots of commands. I want to categorize the commands into subfiles but am unsure how to resolve the dependencies. main.py is the parent. It looks like this: So, we make a new Typer app and import everything from the submodules. Simple enough. Each of the submodules contains Typer commands, like booklist: Here’s the problem:
What is the correct way to import this class?
I have the following repository structure: In moduleB.py I need to import MyClass, I use the following command: When I run the main() function in moduleB.py I have the following error: ModuleNotFoundError: No module named ‘directoryA’ I run the moduleB.py from directoryB in the following way: How could I fix this problem? Answer The best you can do to organizing
Print variable from external file. NameError: name ‘x’ is not defined
I would like to get that: if I select item A in the combobox of main.py, then the variable example is printed as placeholder in phrase (both are located in the external file external.py). So I would like to simply get the phrase of external.py to be printed in the textbox in main.py. The problem is that phrase is in
How to install NetCDF4 module in Spyder?
I don’t know why this is causing me so much headache. I know how to use pip, and have the latest version, but still when running a script in Spyder that requires netCDF4 (import netCDF4) Spyder always returns: I opened cmd, pip install netCDF4, confirmed it installed OK. Shouldn’t this be enough? I manually copied a downloaded version of netCDF4,
Imported package searches for modules in my code
Can someone explain me what is going on here and how to prevent this? I have a main.py with the following code: I outsourced some functions into a module named utils.py: When I run this I get the following output: So it seems like the torch package I imported has also a utils resource (package) and searches for a module
How to limit a Python module to expose specific parts
I just made a module in python but I don’t want people to do this: and this then shows all methods and variables I added to the module. I just want them to see specified ones because I have many additional ones that are only for internal use. Answer If this is your module mymodule.py: Importing it directly like this:
Importing module on python / jupyter
I made very simple test.py -file and I want to use it as module: When I run another notebook and try to import it, the import is “succesful”. However, when I run my code it comes back: I can by-pass this by editing my code: and then it will work. I do not quite understand why I can’t run the
Jupyter notebook cannot find module
I’m trying to load a module called folium into my Jupyter Notebook environment. When I attempt to load this module, a ModuleNotFoundError is returned. When I run !pip list in the same Jupyter Notebook environment, folium is listed amongst my installed modules. How do I successfully load this module? Answer Could it be that you expect a certain Python installation
Scrapy can’t find items
I am currently still learning Scrapy and trying to work with pipelines and ItemLoader. However, I currently have the problem that the spider shows that Item.py does not exist. What exactly am I doing wrong and why am I not getting any data from the spider into my pipeline? Running the Spider without importing the items works fine. The Pipeline