Invoking the python 3.10.6 interpreter with no arguments produces the following output in the presence of a (possibly empty) file called dis.py in the working directory. Clearly I shouldn’t have my own files called dis.py lying around in the working directory! Are the names of all of the other modules included by inspect.py also “reserved”? Shouldn’t the modules inspect.py imports
Tag: python-module
Python program that tells you whether or not you need an umbrella when you leave the house [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago. Improve this question The program should: Ask you if it is raining using input() If the input is ‘y’, it should output ‘Take
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:
ModuleNotFoundError: No module named ‘sharedFunctions’
I have a Python project in which I have the following folder structure: The download_module/__init__.py has the following code: The sharedFunctions.py file contains the following function: Then on the useSharedFunction.py I try to import the shared function and use it like this. When I try to run this by using python3 useSharedFunction.py I got the following error: I do believe
Asyncio combined with custom modules and aiohttp
I am trying to sleep a module for a couple seconds, while sleeping, the script should continue running. When the sleep is over, the module should put data[“found”] = True, but the code never reaches past asyncio.sleep() The code should print: “bulbasaur” “do stuff” x 5 “bulbasaur” But bulbasaur never comes back. main.py: pokemon.py: nba.py Answer The issue lies in
How to override module name (__name__)?
I have two classes in separate files, a.py and b.py. I can not modify a.py in any way. The log output is: I want to change __name__ so that a child class’s call should log called in b. My project logs its module name as part of the output. However, when I inherit a class and call the parent class
‘Namespace’ object is not iterable
Attempting to pass an undetermined amount of integers using argparse. When I input: py main.py 3 2 Error Namespace Argument is not iterable I think is is because I am passing an argument that is not of the correct type. After reading through all the documentation I could find I cannot figure out how to make this work. I want
Get type object defined inside doctest by type name
I am trying to doc-test a method that accepts a module object module and a string with the name of the type type_name inside that module : When I am trying to get the type object with getattr (in reality, the method does more than just that), I am getting the error: Is it possible to doc-test this method without
Unable to load submodules of a Python package: ModuleNotFoundError: No module named
I am new to Python. This looks like a very simple problem but I am unable to solve it after trying my best. I am trying to publish a python package that I developed to an artifact store. However, when I download the package on a target machine, it runs into the error about inner modules not found. The packaging
How to install external modules in a Python Lambda Function created by AWS CDK?
I’m using the Python AWS CDK in Cloud9 and I’m deploying a simple Lambda function that is supposed to send an API request to Atlassian’s API when an Object is uploaded to an S3 Bucket (also created by the CDK). Here is my code for CDK Stack: The lambda function code uses the requests module which I’ve imported. However, when