importerror

AttributeError: '<invalid type>' object has no attribute 'exit'

☆樱花仙子☆ 提交于 2019-12-13 09:44:32
问题 Throws error: Line 2: AttributeError: '<invalid type>' object has no attribute 'exit' when from sys import exit is run. How do I fix this? Problem part of code: from sys import exit 回答1: Did you happen to create a module or file called sys ? If so you are importing from your local module rather than from the built-in Python sys module Otherwise, these import commands are case sensitive, make sure everything is in lower case (it is in your post, but you never know): from sys import exit 来源:

python swig : ImportError wrong ELF class: ELFCLASS64

。_饼干妹妹 提交于 2019-12-13 09:00:35
问题 I am trying to interface from python to c++ code via swig. I get the following error , while trying to execute my script. File "./driver.py", line 4, in <module> from fixMessageSim import * File "/var/user/pradyotd/testframework/fixMessageSim.py", line 12, in <module> import MessageFactory File "/var/user/pradyotd/testframework/MessageFactory.py", line 25, in <module> _MessageFactory = swig_import_helper() File "/var/user/pradyotd/testframework/MessageFactory.py", line 21, in swig_import

ImportError: No module named… (basics?) [closed]

依然范特西╮ 提交于 2019-12-13 08:07:30
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . A very basic question that has been confusing me. Can't seem to find any solutions online so far... I have a simple script and want to import another script I just made in the same directory. What is the proper way of doing this? I just tried combos of import myfile, from myfolder import myfile,

Why can't I import the AgglomerativeClustering class?

假装没事ソ 提交于 2019-12-13 07:12:34
问题 I would like to use AgglomerativeClustering from sklearn but I am not able to import it. >>> from sklearn.cluster import AgglomerativeClustering Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name AgglomerativeClustering The message dosen't give much information on what's causing the issue, can you help? Python version Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 OS info: 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00

Python 3 import class from subfolder problem

南笙酒味 提交于 2019-12-13 04:24:37
问题 I have a strange problem regarding import classes from subfolders. I'm using Python 3.6 , therefore an __init__.py should be not required in the subfolders. I have the following file structure: root ├── script.py (main) └── custom ├── class1.py └── class2.py This is script.py : from custom.class1 import Class1 from custom.class2 import Class2 if __name__ == '__main__': cl1 = Class1() cl2 = Class2() This is class1.py : class Class1(): def __init__(self): print('Class1') if __name__ == '__main_

Django: ImportError: No module named ?z?

风格不统一 提交于 2019-12-13 03:41:27
问题 Hi I am trying to deploy a django app with uwsgi. I keep getting Import Errors that look like this: ImportError: No module named ?z? -or- ImportError: No module named ?j? -or- ImportError: No module named `?6 So basically the output of the module seems like gibberish and I am unable to figure out the problem. Does anybody have an idea what the problem could be? 回答1: Seems like you have missed a comma in the settings.INSTALLED_APPS, after the app name. Go, check! 来源: https://stackoverflow.com

imports custom module python

旧时模样 提交于 2019-12-13 02:38:43
问题 I have a file I.py and X.py both are custom modules I'm trying to do an import from X.py file like: from myapp.I import Int But, when I try to run in shell, it throws an import error of: ImportError: No module named myapp.I X.py is in a subdir of I.py X.py is in: myapp/a/x.py I.py is in: myapp/ what am I doing wrong? Sorry this is slightly basic, it seems so trivial, but I can't seem to get it to work. Thank you. 回答1: You're going to need an __init__.py within myapp/ and myapp/a/. See What is

Python found No module named package that is installed with conda install

雨燕双飞 提交于 2019-12-13 02:36:55
问题 I do notice there are some similar question asked by different people about why python couldn't locate the packages that are installed using conda install command in their conda environment. Take pyqt for example. 1 I create conda environment: conda create -n myenv python=2.7 pip 2 Activate environment: source activate myenv 3 install packages: conda install pyqt 4 run python: python import pyqt Error report: ImportError: No module named pyqt 5 check out packages installed: pip list doesn't

import error using djangorestframework with django-nonrel

怎甘沉沦 提交于 2019-12-13 02:11:29
问题 I'm working on a Django-nonrel project using Django-rest-framework and I've run into the following error after following the instructions in the Token Authorization section of their Authorization API Guide: ImportError: No module named rest_framework.authtoken Normally I would just assume that this is something to do with my PYTHONPATH but I don't think that's exactly what the problem is because I can import this framework from both IDLE and the project's shell run using manage.py, the latter

How to import this library to Android Studio

天涯浪子 提交于 2019-12-13 01:51:19
问题 How can I import widgets library in this github link to my project??? https://github.com/tobykurien/BatteryFu I tried a way but faced with this error while run : Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 2 回答1: Please follow below steps : Click on File -> New -> Import New Module. Add Souce