On Apr 3, 2008, at 10:54 AM, Trent Mick wrote:
Jacob Davis wrote:
>I just installed the MySQLdb module and I have been able to get it to run in my command line interpreter. I am running Mac Leopard, and Python 2.5. I have tested importing and actually connecting and using a MySQL database, although it issues some warning: SnakeBite:MySQL-python-1.2.2 Snake$ python Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information.
>>>>import MySQLdb
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/ _mysql.py:3: UserWarning: Module _mysql was already imported from
From that message it looks like this "python" is /usr/local/bin/
python (i.e. a separate installation than Apple's system python at /
usr/bin/python and /System/Library/Frameworks/Python.framework).
You can tell for sure by doing:
$ which python
>However, while writing a .py script (with Komodo Edit) I try to simply import the module and the in-Komodo interpreter returns an error: Traceback (most recent call last): File "/Users/Snake/Documents/NPS/Thesis/Source_Code/Genetics/ mysql_connect_test.py", line 11, in <module> import MySQLdb ImportError: No module named MySQLdb
I suspect that this is because your run of Komodo Edit doesn't have
"/usr/local/bin" on its PATH and is using "/usr/bin/python" instead
of the one you typically use on the command line.
You can configure Komodo to know about /usr/local/bin by adding a
"PATH" setting in the "Environment" prefs panel. Arguably Komodo
should just add /usr/local/bin to its runtime PATH by default, but
unfortunately it currently doesn't. Komodo doesn't pick up your
normal bash shell environment because of problems trying to get that
information in general.
Please let me know (or on the komodo-discuss list [^1] or Komodo bug
database [^2]) if you have any problems getting that going.
Cheers,
Trent
[1]: http://listserv.activestate.com/mail...Komodo-discuss
[2]: http://bugs.activestate.com/query.cgi?product=Komodo
--
Trent Mick
trentm at activestate.com
Thanks, that seems to have worked. I added "/usr/local/bin" to the
PATH in the preferences Environment panel in Komodo. Then in
preferences I went into the Python pane and changed my selected
interpreter from "/usr/bin/pythonw" to the now available "/usr/local/
bin/pythonw".
Thanks again,
Jake 0 965 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steven |
last post by:
I'm writing a Python script which can be called from the command-line, and
I want to use my module doc string as the CL help text, but I don't know
how to access my module object from inside the...
|
by: Marcus Schneider |
last post by:
I use PythonWin on WinXP. Every time I change a module, I have to
leave PythonWin and re enter to make it notice I have made changes. I
guess this is not the normal way to do that.. do I have to...
|
by: DataSmash |
last post by:
Hi,
When I import the random module at the python interpreter, it works
fine:
>>> import random
>>> x = random.randint(1,55)
>>> print x
14
>>>
BUT, when I put the same code in a python...
|
by: sir.linying |
last post by:
My php script is to call perl scipt which makes use of
Spreadsheet::ParseExcel module to parse Excel file. I am able to launch
php script from command line so that perl script can run and properly...
|
by: Charles Russell |
last post by:
Why does this work from the python prompt, but fail from a script?
How does one make it work from a script?
#! /usr/bin/python
import glob
# following line works from python prompt; why not in...
|
by: noamsml |
last post by:
Hi,
I am new to python and am currently writing my first application. One
of the problems I quickly ran into, however, is that python's imports
are very different from php/C++ includes in the...
|
by: Stuart D. Gathman |
last post by:
The pyspf package http://cheeseshop.python.org/pypi/pyspf/] can use
either pydns, or dnspython. The pyspf module has a simple driver
function, DNSLookup(), that defaults to the pydns version. It...
|
by: reubendb |
last post by:
Hello,
I am new to Python. I have the following question / problem.
I have a visualization software with command-line interface (CLI),
which essentially is a Python (v. 2.5) interpreter with...
|
by: Samuel A. Falvo II |
last post by:
I have a shell script script.sh that launches a Java process in the
background using the &-operator, like so:
#!/bin/bash
java ... arguments here ... &
In my Python code, I want to invoke...
|
by: vincehofmeister |
last post by:
Hey everyone:
I am using py2exe and everything is working fine except one module,
ClientCookie, found here:
http://wwwsearch.sourceforge.net/ClientCookie/
Keeps coming up as not found no...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |