importerror

ImportError: No module named connector.conversion

限于喜欢 提交于 2019-12-10 03:04:00
问题 I'm very new to mySQL and just installed it on my Mac (OS 10.6.8). When I try to connect with the database through Terminal, I get this message: Last login: Tue Jun 17 10:42:23 on console mysqluc -e "help utilities" GEdit-2:~ Eric$ mysqluc -e "help utilities" Traceback (most recent call last): File "/bin/mysqluc", line 23, in from mysql.utilities.common.options import license_callback, UtilitiesParser File "/Library/Python/2.6/site-packages/mysql/utilities/common/options.py", line 35, in from

Why did reinstalling Silverlight break my Import configuration?

本秂侑毒 提交于 2019-12-10 02:31:08
问题 Based on the answer here: Which, if any, recent Windows updates should I uninstall to revivify Silverlight or rectify other problems?, I uninstalled / reinstalled Silverlight and rebooted. Now, though, I get a compilation error, namely: "The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk." It points to this line in a *.csproj

ImportError: No Module named xlwt

走远了吗. 提交于 2019-12-10 02:04:14
问题 My sytem: Windows, Python 2.7 I downloaded a package and want to include it in my script. After I unzipped the package, here is my folder structure: Work xlwt-0.7.3 (contains a setup.py ) xlwt (contains __init__.py among others) My script runs from the top-level (Work) folder. Using import xlwt in my script produces: ImportError: No Module named xlwt How do I import xlwt? 回答1: First off, try using easy_install or pip to install it into your pythonpath: easy_install xlwt or pip install xlwt

Checking module name inside 'except ImportError'

拥有回忆 提交于 2019-12-10 00:50:53
问题 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

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

谁说我不能喝 提交于 2019-12-09 19:24:22
问题 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

Numpy install under Ubuntu (12.04) causes Python ImportError

痴心易碎 提交于 2019-12-08 18:18:29
Under Ubuntu (12.04), installed python (2.7.5) with numpy (1.8rc2) using openblas into own environment (/din). The numpy site.cfg file is configured to point to openblas, and compiled as: $ python setup.py build $ sudo python setup.py install --prefix=/home/Programs/din/local $ python Python 2.7.5 (default, Oct 24 2013, 15:33:08) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/Programs/din/local/lib/python2.7/site-packages/numpy/__init__.py", line 137

Catch python 'ImportError' if import from source directory

我是研究僧i 提交于 2019-12-08 14:32:03
问题 When one tries to import a module foo while being in the source directory, one gets an rather confusing ImportError message: ImportError: No module named foo . How can I easily catch this case and return a more informative message, e.g. 'Please do not load module foo from the source directory'? Having the __init__.py , I would start with: try: from _foo import * except ImportError: ## check whether in the source directory... So I would like to distinguish the different causes for an

Trouble installing PySDL2 on Windows. (No module error)

一曲冷凌霜 提交于 2019-12-08 13:35:22
问题 So I tried to install pySDL2 just now, but I keep getting an error stating: No module named 'sdl2.util' I've followed the directions from the website, so I have no idea why this is not working. And I don't see anyone else asking this. 1: I downloaded: "PySDL2-0.9.2.zip" from BitBucket. 2: I unzipped the folder and moved the contents out. 3: I went to my command line, and then navigated to the directory containing the setup.py 4: I typed (As directed in the instructions): python setup.py

Python ImportError- what is wrong here?

天大地大妈咪最大 提交于 2019-12-08 11:52:56
问题 I am new to programming and Python. I am following the Learn Python the Hard Way book. As a part of exercise 25, I wrote a script: def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return words def sort_words(words): """Sorts the words.""" return sorted(words) def print_first_word(words): """Prints the first words after popping it off.""" word = words.pop(0) print word def print_last_word(words): """Prints the last word after popping it off."""

How to import all defined functions from python script one into python script two? [duplicate]

▼魔方 西西 提交于 2019-12-08 11:37:23
问题 This question already has answers here : Importing user defined modules in python from a directory (2 answers) Closed 2 years ago . I am trying to import a python script containing several defined functions into a different python script using this approach via SO. Since the script I would like to import defines many functions (some of which are nested inside other functions), I would prefer to import the entire script rather than each function individually. I am using a simpler example below