CPAnalyst on MacOS 10.6 (connection to mysql does not work)?


I downloaded CPAnalyst_2.0_r10530_mac.dmg and installed. I then generated parameter file using CellProfiler (writing to a local mysql database). When trying to use I keep getting the error message listed below (here in the table tool, but the same error occurs in other tools) which suggest a fundemental problem in the code connecting to the mysql database.

Any idea for solution?



An error occurred in the program:
TypeError: connect() argument 3 must be string, not None

Traceback (most recent call last):
File “tableviewer.pyc”, line 759, in on_load_db_table
File “dbconnect.pyc”, line 634, in GetTableNames
File “dbconnect.pyc”, line 47, in fn
File “dbconnect.pyc”, line 404, in execute
File “dbconnect.pyc”, line 261, in connect
File “build/bdist.macosx-10.3-i386/egg/MySQLdb/”, line 74, in Connect
File “build/bdist.macosx-10.3-i386/egg/MySQLdb/”, line 170, in init

Hi Nir,

Sorry for the slow reply. Did you edit the properties file to reference your database schema? Hostname, etc.
Also, please try loading the CPA example database
and let us know how that goes.


Hello I am also having this problem. The example works fine.



some functions work when data is exported as sqlite, but then for some strange reason i’m restricted to analysing a very small slice of the images. I’ve using KNIME to view the data from the mysql database and it works fine, there’s just this problem with CPA as mentioned above. Thanks for any help!


Hi Jack,

This is likely a CPA Properties file issue. Just some thoughts without having much else to go on:

  • Is there any terminal output to report?
  • Look at your properties file - are the database tables correct? Are the objects names and the channels correct? etc.
  • Do the Classifier thumbnails all look ok when you fetch them?
  • Do you only have a single per_object table? CPA works only with a single object type at a time.
  • Is there anything common to the “small slice of images” that CPA has access to?

You can post your properties file and it might help us to debug.


Hello David thank you so much for your reply. When I open CPA, select my properties file, and then try to open any of the tools I get this (e.g. with image viewer):

An error occurred in the program:
TypeError: connect() argument 3 must be string, not None

Traceback (most recent call last):
File “/Applications/”, line 287, in launch_image_viewer
File “imageviewer.pyc”, line 227, in init
File “imageviewer.pyc”, line 668, in OnOpenImage
File “datamodel.pyc”, line 153, in GetAllImageKeys
File “datamodel.pyc”, line 83, in _if_empty_populate
File “datamodel.pyc”, line 48, in PopulateModel
File “dbconnect.pyc”, line 1522, in CheckTables
File “dbconnect.pyc”, line 1508, in is_view
File “dbconnect.pyc”, line 64, in fn
File “dbconnect.pyc”, line 481, in execute
File “dbconnect.pyc”, line 323, in connect
File “MySQLdb/init.pyc”, line 81, in Connect
File “MySQLdb/connections.pyc”, line 187, in init

I don’t really know what to look for in the properties file to be honest with you, but I can’t use classifier either when exporting to mysql. If I export to sqlite, the classifier only picks objects from a really small region at the top of the image and doesn’t go any further, it’s the same region on each image - a horizontal band at the very top. - I just tried to attach my properties file but it says "The extension properties is not allowed."
I have three object types (nuclei, and two kinds of cell body stain), and I’ve tried exporting as single object table, single object view, and also as one table per object type, I still get the same problem.
I did also want to export object relationships, but this always causes errors when processing reaches the export to database stage.
Thanks a lot, please let there’s any other information I can supply.

(1) Zip your properties file and the Forum wil accept it. Or use Dropbox or Google Drive
(2) Are you sure you chose SQLite in ExportToDatabase? The error cites MySQL. You can also look at the top of your properties file and it should have this line:

If SQLite is really not the issue, then look at your prop file entries for “cell_x_loc” and “cell_y_loc”. Do those columns in your database exist and reference the correct object?


Thanks David,
I tried both mysql and sqlite, the terminal output I copied in the last post was the mysql, and the sqlite one is where it only classifies objects at the top of the image.
here’s the mysql properties file: … rties?dl=0
and this is the sqlite: … rties?dl=0
I think those columns are correct, if I read the database with KNIME it all works ok, and the data from all objects can be graphically represented. Here’s what it says in the properties file:
cell_x_loc = Nuclei_Location_Center_X
cell_y_loc = Nuclei_Location_Center_Y

Any new ideas on this?



HI Jack,

First, I would set check_tables in your properties file to “no”, as the error seems to indicate that it is in this checking step that there is an issue, but we may just be side-stepping the underlying issue. This may let CPA at least load the MySQL database, even though there may be an anomaly. For MySQL you do need to have a local server running for this to work (sorry if that was obvious!), but if KNIME can read it then that is not the issue.

I don’t really see anything else obvious. PlateViewer will not work without plate_type, but Classifier should work. I would next check very carefully

  • database name
  • the database table names
  • the content of the columns Nuclei_Location_Center_X/Y (these are simply pixel X/Y locations in the image of the object centroids)
  • The Image Path and File name columns – if you concatenate each of your 4 channels, do they point to valid files?
  • Finally, skim through your database for anomalies – are there NaNs? Are there some columns that are all zeros? Do you have only a single object type? (Look in ExportToDatabase for this setting)

Let us know,