When I change/add a variable to my config.py file and then try to import it to my Jupyter Notebook I get: ImportError: cannot import name ‘example_var’ from ‘config’ config.py: jp_notebook.ipynb: But after I restart the Jupyter Kernel it works fine until I modify the config.py file again. I read somewhere that it’s because jupyter already cached that import. Is there
Tag: import
How do I make a list of imported classes in Python?
Is there a way to avoid having to call foo(x)for each imported object? Some context: a, b, c are webpage classes and foo is a route() function that creates a route for each webpage. Update: There will be a growing list of imported classes in the main module as the application grows. I mentioned a, b, and c simply as
How can I convert a .py to .exe using pmw? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I’m building a GUI program in Python 3.8 and I want to convert
I cannot understand the module of the python
Thankyou for helping me in advance. What I am curious is this. I made the File A, and in there exist module named B, and there is function C. Then to use the C, I should type from A import B B.C() Something like this. but when I use the module numpy, there is file named numpy, and there are
How can I import subpackage?
I have a file structure like this: Dir2.__init__.py have has the same code, but with .Something2 Something.py has simple add method, Something2.py has simple sub method. What I need: But I get an error AttributeError: module ‘Dir1’ has no attribute ‘Dir2’. If I use from .Dir2 import * in Dir1.__init__.py code in test.py works, but also works print(Dir1.sub(10, 14)), what
How to solve ImportError: dlopen(): Symbol not found:…. Expected in: flat namespace
Can anyone help me solve this issue? I’m using a Mac if that’s of any relevance Answer I couldn’t quite figure out what the issue was but I’m assuming __PyEval_GetBuiltinId was broken/uninstalled. So all I did to fix this was pip uninstall recordclass and then pip install –no-cache-dir recordclass and it seemed to have worked
Do I need to import submodules directly?
Let’s say I have a module foo and a submodule foo.bar. If I want to use a method in foo.bar, do I need to import foo.bar directly or is importing foo sufficient? For example, the following throws an error: and the following works: But I’m not sure if this is generally what’s needed, or if there’s something wrong with my
Python 3.6 Module cannot be found: Folium
I am trying to import folium into a Jupyter notebook I’m working on and I cannot seem to solve the import issues with the Folium library. Has anyone else solved this problem? Output from the above yields: Answer From the source: Choose the sandbox folder of your choice (~/sandbox for example) Clone folium from github: Run the installation script
Module imports and __init__.py
I am trying to understand what the best practices are with regards to Python’s (v2.7) import mechanics. I have a project that has started to grow a bit and lets say my code is organized as follows: The package name is foo and underneath it I have module Foo.py which contains code for the class Foo. Hence I am using
Python imports relative path
I’ve got a project where I would like to use some python classes located in other directories. Example structure: The absolute path varies, because this project is run on different machines. When my python file with MySampleClass located in /mydir is executed, how do I import OtherClassRoot located in /dir or OtherClassA located in /subdirA? I tried things like: or