Import Error:No module named app.management.commands - python

when I run the command to import my python file, i am getting import error saying no modue named app.management.commands.
>>> from app.management.commands import scripty
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named app.management.commands
Can anyone please help me.

Is app.management.commands in your sys path?
Looks like you have to import it using <project_name>.app.management.commands.

Related

import from utils import module returns cannot import even though other modules from same file work

I have a utils file from a GitHub repo and I added some simple functions to it (to unpick and pickle) and the import statement
from utils import existing_module, unpicklefile
returns the following
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name 'unpicklefile' from 'utils'
but the other functions import fine, so this isn't a sys.path error.
Help :D

How can I import functions from other folders in Python project?

I cannot import the functions from other packages in my Python project.
As suggested, I added
sys.path.append(os.path.abspath('../ExportExcel'))
from ExportExcel.export_excel import export_excel
at the beginning of the clip_finder.py.
I also put
sys.path.append(os.path.dirname(__file__)
inside the export_excel.py.
Inside ExportExcel.init.py I put
from .export_excel import export_excel
However I still get this error:
C:\Main\SupportScripts\ClipFinder>python clip_finder.py -h
Traceback (most recent call last):
File "C:\Main\SupportScripts\ClipFinder\clip_finder.py", line 12, in <module>
from ExportExcel.export_excel import export_excel
ModuleNotFoundError: No module named 'ExportExcel'
How can I make it work?

Error while importing localization

I downloaded the localization package in Anaconda. But when I try to import it I get the following error:
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import localization File "~\Python\Python36-32\lib\site-packages\localization\__init__.py", line 1, in <module>
from geoProject import *
ModuleNotFoundError: No module named 'geoProject'
I do not know what to do, can someone please help me out?
"geoProject", must be your project name, not the name of the module you are trying to input.
Try:
from your module import *
or just
import yourmodule
It works if your module is in current directory. Unless you should write the full path to your module

Import home-made python function in paraview

I wanted to import basic functions in the python shell included in paraview. I tried:
import os
os.chdir('/path/to/my/directory')
import hello_world
Got the result:
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'hello_world' is not defined
while I have a hello_world.py in the directory …
Try this instead:
import sys
sys.path.append("/path/to/my/directory")
import hello_world

Cannot import name _args_from_interpreter_flags

When I try to import multiprocessing in Python 2.7.5 on OS X 10.6.8, I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 65, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py", line 40, in <module>
from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags
I also tried to install python2.7.6 with homebrew, but this error still occurs.
It sounds like a circular import issue. Try adding this to the the rest of your imports:
from subprocess import _args_from_interpreter_flags
There is a comment above the function in subprocess.py:
# XXX This function is only used by multiprocessing and the test suite,
# but it's here so that it can be imported when Python is compiled without
# threads.
May be related.

Categories