importerror

Checking module name inside 'except ImportError'

假如想象 提交于 2019-12-04 22:56:38
try: import MySQLdb # some action except ImportError as err: # fallback code PyCharm gives a code inspection warning on that: 'MySQLdb' in try block with 'except ImportError' should also be defined in except block This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items. Ok, I thought the warning is reasonable, because the fallback code assumes that 'MySQLdb' is not installed, while it could be some different error that

Problem trying to install PyCurl on Mac Snow Leopard

巧了我就是萌 提交于 2019-12-04 22:54:00
问题 My app needs to use PyCurl, so I tried to install it on my Mac but I found a lot of problems and errors. Requirement: First of all I have to say that the version of Python working on my Mac is 32 bit based, because I need to use WxPython, that needs 32 bit Python. For doing this I used: defaults write com.apple.versioner.python Prefer-32-Bit -bool yes To install PyCurl I used: sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl And the terminal returned: Best match: setuptools 0

VS 2015 Import and Export Settings, Disappearing Window

前提是你 提交于 2019-12-04 22:47:54
Post has been Updated 03-05-2017 People were talking about this problem here: VS 2010 - Import Export Settings VS2013 cannot import settings from TOOLS>Import and Export Settings Currently in 2017 the issue is still affecting Visual Studio and SQL Server Management Studio. Below is Import Export Dialog Status for my two setups: Win7 Ultimate x64: SSMS 2014 - Working, VS 2013 - Working, VS 2015 - Disappears Win10 Pro x64 1703 (Fresh Install): SSMS 2016 - Disappears, VS 2017 - Disappears (Everything is updated to their newest stable versions) Details: As soon as I click "Next' button here: Video

ImportError: No module named lib. Unable to import pandas, numpy, scipy, matplotlib

旧城冷巷雨未停 提交于 2019-12-04 21:40:02
I recently updated a number of packages and my version of EPD Canopy (to1.4.1.1975) and now I'm unable to import pandas , numpy , scipy or matplotlib . I get the ImportError below. I've also tried importing from the command prompt but I can the same error. pandas - 0.14.0-1 numpy - 1.8.0-2 scipy - 0.14.0-1 matplotlib - 1.3.1-8 Does anybody have any suggestions as to how I could fix this? From this Stackoverflow question it seems like I might need to change/move something to a different directory. Could somebody explain how I could go about this? This documentation was suggested but I'm not

I get 'ImportError: No module named web' despite the fact that it is installed

随声附和 提交于 2019-12-04 20:38:17
I would like to run a simple 'Hello world' app. Every time I run it I get 'ImportError: No module named web' I installed web.py using pip and using easy_install several times. I tried uninstalling it and installing again. I tried installing it a as sudo. Nothing seems to work. I use OS X Code of the application: import web urls = ( '/', 'index' ) app = web.application(urls, globals()) class index: def GET(self): greeting = "Hello World" return greeting if __name__ == "__main__": app.run() I tried to run this app using this commend: python /Users/mptorz/webversion/bin/app.py http://0.0.0.0:8080

Ubuntu add directory to Python path

旧城冷巷雨未停 提交于 2019-12-04 19:33:33
问题 I want to run third part tool written in python on my ubuntu machine (corgy tool). However I don't know how to add additional modules to Python path. cat doc/download.rst There is currently no setup.py, so you need to manually add the download directory to your PYTHON_PATH environment variable. How can I add directory to PYTHON_PATH? I have tried: export PYTHON_PATH=/home/user/directory:$PYTHON_PATH && source .bashrc export PATH=/home/user/directory:$PATH && source .bashrc python import sys

Distinguish between ImportError because of not found module or faulty import in module itself in python?

和自甴很熟 提交于 2019-12-04 16:03:25
I have a few modules in python, which are imported dynamicly and all have the same structur (plugin.py, models.py, tests.py, ...). In the managing code i want to import those submodules, but for example models.py or tests.py is not mandatory. (So i could have plugin_a.plugin and plugin_a.tests but only plugin_b.plugin ). I can check if the submodule exists by try: __import__(module_name + ".tests") except ImportError: pass That will fail, if module_name+".tests" is not found, but it will also fail if the tests -module itself will try to import something, which is not found, for example because

Zipline import error. No module named zipline.transforms

六眼飞鱼酱① 提交于 2019-12-04 15:47:41
I am not able to import the zipline.transforms module >>> from zipline.transforms import batch_transform Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'zipline.transforms' Disclaimer: I'm currently a maintainer of Zipline. I'm guessing the reason you're seeing this error is because that particular module was removed a while back (assuming you're using zipline 1.0.0 or later). If you want to do things similar to transforms you'll need to call data.history() to get your pricing data, and call numpy/pandas functions like .avg() or .std() , or

Bizarre error importing settings in django

依然范特西╮ 提交于 2019-12-04 12:10:56
问题 I have many projects working in ubuntu with python2.7 and virtualenv/virtualenvwrapper, in my work some developers works with macosx and windows, generally I create the project as usual: django-admin.py start project x And we use svn for cvs, but in some point, without nothing rational for me, when I try something like: python manage.py runserver doesn't work, but is just for me and is in my laptop, that doesn't happens in productions servers or another developers. any ideas? I got this error

Django Management Command ImportError

耗尽温柔 提交于 2019-12-04 10:34:00
I have problem with imported module into my qsl/management/commands/<customcommand>.py file. in fact, my app structure is : qsl/management/commands/ : dir for my management commands qsl/management/jobs/ : dir for my mangement jobs jobs are python classes that contains the job i want to be done in the coresponding command e.g: news command in qsl/management/commands/ imports news job in qsl/management/jobs/ my error when i want to execute python manage.py news is an importerror : no module named management.jobs.news Make sure that all the folders have a __init__.py in them so that they can be