From owner-freebsd-python@freebsd.org Thu Jan 26 23:27:51 2017 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF8E6CC3990 for ; Thu, 26 Jan 2017 23:27:51 +0000 (UTC) (envelope-from karly@kipshouse.net) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 83C4A7BA for ; Thu, 26 Jan 2017 23:27:51 +0000 (UTC) (envelope-from karly@kipshouse.net) Received: by mailman.ysv.freebsd.org (Postfix) id 8025ACC398E; Thu, 26 Jan 2017 23:27:51 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FC8DCC398D for ; Thu, 26 Jan 2017 23:27:51 +0000 (UTC) (envelope-from karly@kipshouse.net) Received: from mgmt.ironboy.kipshouse.net (ironboy.kipshouse.net [IPv6:2001:470:835a:4242::42]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "mx.kipshouse.net", Issuer "Starfield Secure Certificate Authority - G2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1906E7B9 for ; Thu, 26 Jan 2017 23:27:50 +0000 (UTC) (envelope-from karly@kipshouse.net) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kipshouse.org; i=@kipshouse.org; q=dns/txt; s=kh-ss; t=1485473271; x=1517009271; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; z=Date:=20Thu,=2026=20Jan=202017=2015:02:25=20-0800|From: =20Karl=20Young=20|To:=20DTD=20|Cc:=20python@FreeBSD.org|Subject:=20Re:=20 MySQLdb=20question|Message-ID:=20<20170126230225.GV26386@ mailboy.kipshouse.net>|References:=20|MIME-Version:=20 1.0|In-Reply-To:=20; bh=XXrSeZxM5XOmDMOv0lngdlPznovk99C5WXtVyQU3O00=; b=UHRitqWMH0AtQh1uGFfX9EhdpD7Qii78zLQDT6vuPWUoUwtNGKLHwqdW D+vBEs5vX5Wqpv6ChYXXM199+11bJUPROI6C++G9F/KaF9lLn243tJxM2 eo+eCx1kaDxL11pDOuW+4oZ2rMH9ZcTTv0ainEAnOib9oYoLFBR0iZC6Z oByydYgOxlRHolZyVpXt0nRylzhDnTFPdVATpxDNrRqGUqFnkVJj3A041 FFeq4Pk6W2HNQnJuVTdas4puKqsqUQdIFvraOYM8+O8lcY1KY81ztaiUp vKPHxSg+AFrp6J6eSJVYUNm1+b8AipOkYlUv61qoUooq3HX2M5p4Xt5Kj w==; Authentication-Results: d2.ironport.kipshouse.net; dkim=none (message not signed) header.i=none; spf=None smtp.pra=karly@kipshouse.org; spf=None smtp.mailfrom=karly@kipshouse.net; spf=None smtp.helo=postmaster@mailboy.kipshouse.net Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of karly@kipshouse.org) identity=pra; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="karly@kipshouse.org"; x-conformance=sidf_compatible Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of karly@kipshouse.net) identity=mailfrom; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="karly@kipshouse.net"; x-conformance=sidf_compatible Received-SPF: None (d2.ironport.kipshouse.net: no sender authenticity information available from domain of postmaster@mailboy.kipshouse.net) identity=helo; client-ip=2001:470:835a:1010::26; receiver=d2.ironport.kipshouse.net; envelope-from="karly@kipshouse.net"; x-sender="postmaster@mailboy.kipshouse.net"; x-conformance=sidf_compatible X-SBRS: None X-MID: 233401 X-RemoteIP: 2001:470:835a:1010::26 X-RemoteHost: 2001:470:835a:1010::26, mailboypriv.kipshouse.net X-IronPort-AV: E=McAfee;i="5700,7163,8420"; a="233401" Received: from mailboypriv.kipshouse.net (HELO mailboy.kipshouse.net) ([IPv6:2001:470:835a:1010::26]) by d2.ironport.kipshouse.net with ESMTP; 26 Jan 2017 15:27:49 -0800 Received: by mailboy.kipshouse.net (Postfix, from userid 500) id 8158543F1B; Thu, 26 Jan 2017 15:02:25 -0800 (PST) Date: Thu, 26 Jan 2017 15:02:25 -0800 From: Karl Young To: DTD Cc: python@FreeBSD.org Subject: Re: MySQLdb question Message-ID: <20170126230225.GV26386@mailboy.kipshouse.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Arbitrary-Number-Of-The-Day: 42 X-URL: http://www.kipshouse.org/karly X-Work-URL: http://www.cisco.com/ X-Disclaimer: My opinions do not necessarily represent those of my employer. User-Agent: Mutt/1.5.20 (2009-12-10) X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 23:27:51 -0000 DTD(doug@safeport.com)@2017.01.26 13:23:56 -0500: > I am using py27-MySQLdb-1.2.5 (the default) for FreeBSD 10.3 > > cmd="update ipv4 set s8='%s',s16='%s',s24='%s' where ip='%s'" % (s8,s16,s24,row[0]) > c.execute(cmd) When you say that it isn't working, I assume you mean it's not updating any rows? To see if that's the case, you can assign the return from execute and print the result, and print it out. numrows = c.execute(cmd) print numrows Or use the rowcount attr of the cursor print c.rowcount If it's showing 0 rows, try running select where select * where ip='1.186.248.251 Is it possible you're connecting to a different host/db than you're using for your manual SQL? -karl > > does not work. I actually used try/except. It does not throw an error > > cmd=update ipv4 set s8='1.',s16='1.186.',s24='1.186.248.' where ip='1.186.248.251' > > is a valid statement and works. It just does not work through > execute. I also tried appending a ';' to cmd > > Thanks for any help/thoughts > > _____ > Douglas Denault > http://www.safeport.com > doug@safeport.com > Voice: 301-217-9220 > Fax: 301-217-9277 > _______________________________________________ > freebsd-python@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-python > To unsubscribe, send any mail to "freebsd-python-unsubscribe@freebsd.org"