Re: os.walk the apostrophe and unicode
On Sun, 25 Jun 2017 08:18:45 -0600 Michael Torrie <torr...@gmail.com> wrote: > On 06/25/2017 06:19 AM, Rod Person wrote: > > But doing a simple ls of that directory show it is unicode but the > > replacement of the offending character. > > > > http://rodperson.com/graphics/uc/ls.png > > Now that is really strange. Your OS seems to not recognize that the > filename is in UTF-8. I suspect this has something to do with the NAS > file sharing protocol (smb). Though I'm pretty sure that Samba can > handle UTF-8 filenames correctly. > > > I am in fact using Python 3.5. I may be lacking in unicode skills > > but I do have the sense enough to know the version of Python I am > > invoking. So I included this screenshot of that so the version of > > Python and the files list returned by os.walk > > > > http://rodperson.com/graphics/uc/files.png > > If I create a file that has the U+2019 character in it on my Linux > machine (BtrFS), and do os.walk on it, I see the character in then > string properly. So it looks like Python does the right thing, > automatically decoding from UTF-8. > > In your situation I think the problem is the file sharing protocol > that your NAS is using. Somehow some information is being lost and > your OS does not know that the filenames are in UTF-8, and just > thinks they are bytes. And therefore Python doesn't know to decode > the string, so you just end up with each byte being converted to a > unicode code point and being shoved into the unicode string. > > How to get around this issue I don't know. Maybe there's a way to > convert the unicode string to bytes using the value of each character, > and then decode that back to unicode. I think you theory is on the correct path. I'm actually attached to the NAS via NFS not samba. And just quickly looking into that it seems the NFS server needs and option set to pass unicode correctly...but my NAS software doesn't allow my access to settings only to turn it on or off. Looks like my option is the original correct the file name. -- Rod http://www.rodperson.com Who at Clitorius fountain thirst remove Loath Wine and, abstinent, meer Water love. - Ovid -- https://mail.python.org/mailman/listinfo/python-list
Re: os.walk the apostrophe and unicode
Ok...so after reading all the replies in the thread, I thought I would be easier to send a general reply and include some links to screenshots. As Peter mention, the logic thing to do would be to fix the file name to what I actually thought it was and if this was for work that probably what I would have done, but since I want to understand what's going on I decided to waste time on that. I have to admit, I didn't think the file system was utf-8 as seeing what looked to be an apostrophe sent me down the road of why is this apostrophe screwed up instead of "ah this must be unicode". But doing a simple ls of that directory show it is unicode but the replacement of the offending character. http://rodperson.com/graphics/uc/ls.png I am in fact using Python 3.5. I may be lacking in unicode skills but I do have the sense enough to know the version of Python I am invoking. So I included this screenshot of that so the version of Python and the files list returned by os.walk http://rodperson.com/graphics/uc/files.png So the fact that it shows as a string and not bytes in the debugger was throwing me for a loop, in my log section I was trying to determine if it was unicode decode it...if not don't do anything which wasn't working http://rodperson.com/graphics/uc/log_section.png On Sun, 25 Jun 2017 10:47:18 +0200 Peter Otten <__pete...@web.de> wrote: > Steve D'Aprano wrote: > > > On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote: > > >> if everything worked correctly? Though I don't understand why the > >> OP doesn't see > >> > >> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac' > >> > >> which is the repr() that I get. > > > > That's mojibake and is always wrong :-) > > Yes, that's my very point. > > > I'm not sure how you got that. > > I took the OP's string at face value and pasted it into the > interpreter: > > # python 3.4 > >>> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in > >>> Progress).flac' > '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac' > > > Something to do with an accidental decode to Latin-1? > > If the above filename is the only one or one of a few that seem > broken, and other non-ascii filenames look OK the OP's > toolchain/filesystem may work correctly and the odd name might have > been produced elsewhere, e. g. by copying an already messed-up > freedb.org entry. > > [Heureka] > > However, the most likely explanation is that the filename is correct > and that the OP is not using Python 3 as he claims but Python 2. > > Yes, it took that long for me to realise ;) Python 2 is slowly > sinking into oblivion... > -- Rod http://www.rodperson.com -- https://mail.python.org/mailman/listinfo/python-list
Re: os.walk the apostrophe and unicode
On Sat, 24 Jun 2017 13:28:55 -0600 Michael Torrie <torr...@gmail.com> wrote: > On 06/24/2017 12:57 PM, Rod Person wrote: > > Hi, > > > > I'm working on a program that will walk a file system and clean the > > id3 tags of mp3 and flac files, everything is working great until > > the follow file is found > > > > '06 - Todd's Song (Post-Spiderland Song in Progress).flac' > > > > for some reason that I can't understand os.walk() returns this file > > name as > > > > '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in > > Progress).flac' > > That's basically a UTF-8 string there: > > $ python3 > >>> a= b'06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in > Progress).flac' > >>> print (a.decode('utf-8')) > 06 - Todd’s Song (Post-Spiderland Song in Progress).flac > >>> > > The NAS is just happily reading the UTF-8 bytes and passing them on > the wire. > > > which then causes more hell than a little bit for me. I'm not > > understand why apostrophe(') becomes \xe2\x80\x99, or what I can do > > about it. > > It's clearly not an apostrophe in the original filename, but probably > U+2019 (’) > > > The script is Python 3, the file system it is running on is a hammer > > filesystem on DragonFlyBSD. The audio files reside on a QNAP NAS > > which runs some kind of Linux so it probably ext3/4. The files came > > from various system (Mac, Windows, FreeBSD). > > It's the file serving protocol that dictates how filenames are > transmitted. In your case it's probably smb. smb (samba) is just > passing the native bytes along from the file system. Since you know > the native file system is just UTF-8, you can just decode every > filename from utf-8 bytes into unicode. This is the impression that I was under, my unicode is that strong, so maybe my understand is off...but I tried. file_name = file_name.decode('utf-8', 'ignore') but when I get to my logging code: logfile.write(file_name) that throws the error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 39-41: ordinal not in range(128) -- Rod http://www.rodperson.com Who at Clitorius fountain thirst remove Loath Wine and, abstinent, meer Water love. - Ovid -- https://mail.python.org/mailman/listinfo/python-list
Re: os.walk the apostrophe and unicode
On Sat, 24 Jun 2017 21:28:45 +0200 Peter Otten <__pete...@web.de> wrote: > Rod Person wrote: > > > Hi, > > > > I'm working on a program that will walk a file system and clean the > > id3 tags of mp3 and flac files, everything is working great until > > the follow file is found > > > > '06 - Todd's Song (Post-Spiderland Song in Progress).flac' > > > > for some reason that I can't understand os.walk() returns this file > > name as > > > > '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in > > Progress).flac' > > > > which then causes more hell than a little bit for me. I'm not > > understand why apostrophe(') becomes \xe2\x80\x99, or what I can do > > about it. > > >>> b"\xe2\x80\x99".decode("utf-8") > '’' > >>> unicodedata.name(_) > 'RIGHT SINGLE QUOTATION MARK' > > So it's '’' rather than "'". > > > The script is Python 3, the file system it is running on is a hammer > > filesystem on DragonFlyBSD. The audio files reside on a QNAP NAS > > which runs some kind of Linux so it probably ext3/4. The files came > > from various system (Mac, Windows, FreeBSD). > > There seems to be a mismatch between the assumed and the actual file > system encoding somewhere in this mix. Is this the only glitch or are > there similar problems with other non-ascii characters? > This is the only glitch as in file names so far. -- Rod http://www.rodperson.com Who at Clitorius fountain thirst remove Loath Wine and, abstinent, meer Water love. - Ovid -- https://mail.python.org/mailman/listinfo/python-list
os.walk the apostrophe and unicode
Hi, I'm working on a program that will walk a file system and clean the id3 tags of mp3 and flac files, everything is working great until the follow file is found '06 - Todd's Song (Post-Spiderland Song in Progress).flac' for some reason that I can't understand os.walk() returns this file name as '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac' which then causes more hell than a little bit for me. I'm not understand why apostrophe(') becomes \xe2\x80\x99, or what I can do about it. The script is Python 3, the file system it is running on is a hammer filesystem on DragonFlyBSD. The audio files reside on a QNAP NAS which runs some kind of Linux so it probably ext3/4. The files came from various system (Mac, Windows, FreeBSD). -- Rod http://www.rodperson.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Python and GUI development
On Mon, 1 Dec 2014 23:13:32 +1100 Chris Angelico ros...@gmail.com wrote: On Mon, Dec 1, 2014 at 10:55 PM, Ganesh Pal ganesh1...@gmail.com wrote: Hi folks, I want to design a GUI interface for my project . I wanted it to use it Python and it has to work on freebsd . Please provide me the latest trends for GUI development with python. Regard s Ganesh There are lots of Python GUI toolkits. You can use GTK with PyGObject, or PyQt, or wxPython, or Tkinter, or any of quite a few lesser-known ones. You could do a quick web search to find out which ones work on FreeBSD (probably all, or at least most, of them), and then you could find out something about each one, and make a decision based on that. ChrisA All of the above mentioned work on FreeBSD as I used all to some extent for GUI Apps on FreeBSD. I would say the easiest for a newbie would be PyQt for the fact that you can use the Eric IDE (http://www.freshports.org/devel/eric4/) which will install the QtDesigner which makes designing GUIs easier. -- Rod http://www.rodperson.com He who knows himself to be one way and pretends it is another way is a thief who robs his own soul. The Mahabharata Sakuntala 25 -- https://mail.python.org/mailman/listinfo/python-list
Re: Total Python Newbie needs geting started info.
On 11/20/2013 11:03 AM, Ev J wrote: I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutorial is all about using the interactive interrupter and writing little console programs to learn the language. Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? If not, what is the best free IDE for me to use? What is the best tutorial for the IDE? I am a bit overwhelmed as to how to get started. Thanks for any help. The integrated shell for Visual Studio does not give you the drag and drop GUI builder like is available for VB or C#. I would say for a newbie you at Eric IDE: http://eric-ide.python-projects.org/ It uses the QT widget set and intergrated with QTBuilder to allow you to design GUI via dragging and dropping components. There are other GUI builders like GLADE for gtk, but QtBuilder is probably the closes to what you would be familiar with from using Visual Studio. -- Rod So little pains do the vulgar take in the investigation of truth, accepting readily the first story that comes to hand. -Thucydides History of The Peloponnesian War, 432BC -- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
On Sun, 10 Nov 2013 20:32:11 +0100 Petite Abeille petite.abei...@gmail.com wrote: On Nov 10, 2013, at 8:21 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Perhaps You're in a desert, walking along in the sand, when all of a sudden you look down and see a tortoise. It's crawling toward you. You reach down and you flip the tortoise over on its back. The tortoise lays on its back, its belly baking in the hot sun, beating its legs trying to turn itself over, but it can't. Not without your help. But you're not helping. Why is that? Tortoise? What's a tortoise? LOL! Officially now the best thread every on the internet. From a lurker that has been watching the slow train wreck. -- Rod http://www.rodperson.com He who knows himself to be one way and pretends it is another way is a thief who robs his own soul. The Mahabharata Sakuntala 25 -- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
On Sun, 10 Nov 2013 21:41:54 +0100 Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On Nov 10, 2013 9:01 PM, Rod Person rodper...@rodperson.com wrote: Tortoise? What's a tortoise? Is that a real question? If yes, then it's an animal, similar to a turtle. Ask Google or Wikipedia for more details. Check the movie Blade Runner. -- Rod http://www.rodperson.com He who knows himself to be one way and pretends it is another way is a thief who robs his own soul. The Mahabharata Sakuntala 25 -- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
On Sun, 10 Nov 2013 21:41:54 +0100 Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On Nov 10, 2013 9:01 PM, Rod Person rodper...@rodperson.com wrote: Tortoise? What's a tortoise? Is that a real question? If yes, then it's an animal, similar to a turtle. Ask Google or Wikipedia for more details. http://youtu.be/Umc9ezAyJv0?t=1m10s -- Rod http://www.rodperson.com He who knows himself to be one way and pretends it is another way is a thief who robs his own soul. The Mahabharata Sakuntala 25 -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On 10/2/2013 9:30 AM, Νίκος wrote: You learn and you are forced to solve problems better when you deal with real time problems. https://tinyurl.com/44teepw -- Rod The guide of millers uses only the finest grains: true Roman breads, for true Romans. -- https://mail.python.org/mailman/listinfo/python-list
Re: [CGI] Basic newbie error or server configuration error?
On Mon, 20 Aug 2012 13:41:20 +0200 Gilles nos...@nospam.com wrote: Hello Apache fails running this basic CGI script that I found on the Net: www.acme.com/cgi-bin/test.py?name=myname === #!/usr/bin/env python # Import modules for CGI handling import cgi, cgitb cgitb.enable() # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from field 'name' #name = form['name'].value name = form.getvalue('name') === This is what I get: === Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. === FWIW, the script lives in www/cgi-bin/ where it should, was chmoded to 755, and I put the following .htaccess file: === Options +ExecCGI AddHandler cgi-script .py === I'm not sure where to look for an error. Could it be some non-printed, bad characters that prevent Python from compiling the source code? Thanks for any help. Check the Apache error log, there should be more information there. -- Rod Person http://www.rodperson.com rodper...@rodperson.com Sent From Claws Mail 3.8.0cvs30 Win7 x86 GTK+ 2.16.6/GLib 2.24.0 -- http://mail.python.org/mailman/listinfo/python-list
Re: unable to get simple html file up
On Fri, 3 Aug 2012 09:40:44 -0700 Smaran Harihar smaran.hari...@gmail.com wrote: guys i m still waiting for a reply -- Forwarded message -- From: Smaran Harihar smaran.hari...@gmail.com Date: Thu, Aug 2, 2012 at 12:26 PM Subject: unable to get simple html file up To: python-list@python.org Hi, I am following this tutorialhttp://pointlessprogramming.wordpress.com/2011/02/13/python-cgi-tutorial-2/ and i am not able to get the link.py http://dpaste.de/wJQ0d/ up and running. I should be looking at Html file with link directing to the cgi script. But strangely i can't even see the page itself. Any idea why it is like this? I have made link.py executable. Here is the server.pyhttp://dpaste.de/iEPTk/ . looks like the closing are missing from link.py -- Rod Person http://www.rodperson.com rodper...@rodperson.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Script Works Locally But Not Remotely with SSH
On Sun, 1 Apr 2012 12:32:16 -0700 (PDT) Jedrzej Krzysztof Dec j...@jedrzejdec.eu wrote: Why the does the window not open when the script is started remotely? Thanks. Do You have a GUI over SSH? Something like ssh -X in Linux systems, or do You just have a terminal window? If You just have a terminal, You wont be able to run GUI apps. You need an X server on the XP machine. I've use Xming for this. http://sourceforge.net/projects/xming/?_test=b -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
class checking its own module for an attribute
We have a module called constants.py, which contains related to server names, databases, service account users and there passwords. In order to be able to use constants as command line parameters for calling from our batch files I created the class below that checks to make sure the parameter value is a valid constant and if so return it's value. class ConstantParameterCheck(Action): def __call__(self, parser, namespace, value, option_string=None): if value: if not hasattr(CCBH.constants, value): message = (Invalid parameter value: {0!r}. Value must be a value constant in CCBH.constants..format(value)) raise ArgumentError(self, message) setattr(namespace, self.dest, getattr(CCBH.constants, value)) This works great, but it has to be placed in every script, so I decided why not place this in the constants.py module so it can just be imported. So I did that and got it to work like this: class ConstantParameterCheck(Action): def __call__(self, parser, namespace, value, option_string=None): from CCBH import constants if value: if not hasattr(constants, value): message = (Invalid parameter value: {0!r}. Value must be a value constant in CCBH.constants..format(value)) raise ArgumentError(self, message) setattr(namespace, self.dest, getattr(CCBH.constants, value)) The question is there a way I can do this with out having to import constants when what it's doing is importing itself. It would seem to me that there should be a way for a module to reference itself. In that thinking I have tried if not(hasattr(__file__, value): if not(hasattr(__name__, value): and even: this = sys.argv[0] if not(hasattr(this, value): None of which works. -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: class checking its own module for an attribute
On Wed, 21 Mar 2012 09:56:57 -0700 Chris Rebert c...@rebertia.com wrote: On Wed, Mar 21, 2012 at 8:25 AM, Rod Person rodper...@rodperson.com wrote: snip The question is there a way I can do this with out having to import constants when what it's doing is importing itself. It would seem to me that there should be a way for a module to reference itself. In that thinking I have tried if not(hasattr(__file__, value): if not(hasattr(__name__, value): and even: this = sys.argv[0] if not(hasattr(this, value): None of which works. http://stackoverflow.com/questions/2933470/how-do-i-call-setattr-on-the-current-module Cheers, Chris Thank you! -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: class checking its own module for an attribute
On Wed, 21 Mar 2012 17:59:56 +0100 Peter Otten __pete...@web.de wrote: Rod Person wrote: We have a module called constants.py, which contains [whatever] related to server names, databases, service account users and their passwords. Passwords? Yes, not the best thing, but they are only service account that run nightly batch jobs. Everyone in our IT department knows these password and users. I only deploy the .pyo or .pyc files for this module, although I'm looking into a better way than that. -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: converting from tcl/tkl to python
On Fri, 9 Mar 2012 07:10:19 -0800 (PST) Richard Boothroyd rboothro...@gmail.com wrote: Hi there, First, I am not a developer so go easy on my ignorance ;-). Our company designs and develops hearing aid audibility fitting equipment. (www.audioscan.com). Our current software GUI is all based on TCL/TKL and we are running into issues on developing a prettier GUI in an effort to modernize some of our equipment. Have you looked at Tile? It a theme-able widget set for Tk. http://wiki.tcl.tk/11075 As for python, the default GUI toolkit for Python is Tk, but there are bindings that allow you to use WxWidgets, Qt and GTK. -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: Can not get the result of query in pymssql module of python...
On Thu, 9 Feb 2012 12:34:25 +0530 amarjeet yadav amarjeet.j...@gmail.com wrote: Hi All, This is my first post to any mailing group. I am QA engg and using python for testing automation. I need to connect with Mysql (2008) and mssql databases for executing some queries. I have installed following modules softwares in python 2.7 : python 2.7.2 setuptools MySQLdb Module pymssql module yum install mysql msql-devel freetdf I have installed freetds 0.9version. After installation of all the above components, I have done following things Python 2.6 (r26:66714, Apr 8 2010, 08:46:35) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type help, copyright, credits or license for more information. import pymssql conn = pymssql.connect(host='mssql_server', user='_username', password='_password', database='_db',as_dict=True) cur = conn.cursor() cur.execute('select count(*) from D2.dbo.abc (nolock)') print cur.fetchall() What if you change this to print cur.fetchone() About 95% of my python database work is with MS SQL. I use fetchone when as_dict is True and it seems to work better for me. [] cur.rowcount -1 exit() I am expecting that the result of the query will be 16. But it is not retuning any data from query with no error at any place. On execting the same query in tsql, I got result as 16. -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: Komodo 7 release (Python development tools)
On Wed, 08 Feb 2012 16:52:50 -0500 Terry Reedy tjre...@udel.edu wrote: On 2/8/2012 3:14 PM, Todd Whiteman wrote: My name is Todd. I'm the lead developer for Komodo IDE (Interactive Development Environment) and Komodo Edit (a free, open-source editor) at ActiveState. I wanted to announce that the newest version, Komodo 7, has been released: This is a pretty good release announcement, but a few questions. ... http://www.activestate.com/komodo-ide/python-editor It would seem that the Professional Python Editor is the same as Komodo Edit, but it is unclear why only Python editing would be featured for Komodo IDE. http://www.activestate.com/komodo-edit is the page with the link people need to download just the editor. Does K.Edit let me run a program with one key, like F5 in IDLE? If so, does it leave me in interactive mode (python -i) as IDLE does? I'm not an ActiveState employee, but I have used Komodo IDE since version 4, on FreeBSD and Windows. The selling point of the IDE is definitely the interactive python debugger which isn't in the editor. It also supports more than python, just in case for some old reason you'd find the need to write Perl, Ruby or TCL code. -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to install xmldiff package on WIndows7
On Thu, 5 Jan 2012 10:03:32 -0800 (PST) hisan santosh.s...@gmail.com wrote: Can some one help me out here Its High Priority On Jan 4, 12:47 am, hisan santosh.s...@gmail.com wrote: Hi All i have downloaded xmldiff-0.6.10 from their official site (http://www.logilab.org/859). I have tried installing the same on my 32 bit Windows 7 OS using the command setup.py install but below exceptions are thrown in the console. please help me out in installing this package on Windows Exceptions thrown while installing C:\Users\santosh\Downloads\xmldiff-0.6.10setup.py build running build running build_py package init file '.\test\__init__.py' not found (or not a regular file) package init file '.\test\__init__.py' not found (or not a regular file) running build_ext building 'xmldiff.maplookup' extension gcc -mno-cygwin -mdll -O -Wall -ID:\Python26\include -ID:\Python26\PC - c extensions/maplookup.c -o b uild\temp.win32-2.6\Release\extensions\maplookup.o error: command 'gcc' failed: No such file or directory It trying to compile this extension using GNU gcc. You'd need that to compile this one windows. Don't know if there is a windows version but check http://gcc.gnu.org -- Rod Person http://www.rodperson.com rodper...@rodperson.com 'Silence is a fence around wisdom' -- http://mail.python.org/mailman/listinfo/python-list
Re: Py and SQL
On Wed, 30 Nov 2011 15:30:48 -0500 Verde Denim tdl...@gmail.com wrote: All I have a sql script that I've included in a simple Py file that gives an error in the SQL. The problem is that the SQL code executes correctly in a database IDE environment (in this case ora developer). So, I'm concluding that I'm doing something amiss in the Py code. Does anyone see why this code would return a 'missing expression' sql error? Essentially, the code should start, ask for a privilege, and then collect the priv, role, and user data. Any input is appreciated. #!/bin/bash import time import cx_Oracle dbConn = cx_Oracle.connect('juser', 'pass', '1.2.3.4:/orcl:DEDICATED', cclass = ABC, purity = cx_Oracle.ATTR_PURITY_SELF) pStart = time.time() dbVersion = dbConn.version.split(.) majVer = dbVersion[0] print Oracle Version: %s %(majVer) print Full Version: %s %(dbConn.version) dbCursor1 = dbConn.cursor() dbCursor1.execute('select lpad(' ', 2*level) || c Privilege, Roles and Users from ( select null p, name c from system_privilege_map where name like upper(\'%enter_privliege%\') union select granted_role p, grantee c from dba_role_privs union select privilege p, grantee c from dba_sys_privs) start with p is null connect by p = prior c') dbRowResult = dbCursor1.fetchall() for dbRow in dbRowResult: print dbRow Try changing the wrapping ' ' to and the inside double qoutes to single, like this dbCursor1.execute(select lpad(' ', 2*level) || c 'Privilege, Roles and Users' from ( select null p, name c from system_privilege_map where name like upper(\'%enter_privliege%\') union select granted_role p, grantee c from dba_role_privs union select privilege p, grantee c from dba_sys_privs) start with p is null connect by p = prior c) -- Rod The club is like groceries, and I jus bag a bi@$! Santonio Holmes on the Twitter -- http://mail.python.org/mailman/listinfo/python-list
Creating and Audio Equalizer with python and gstreamer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 For about 3 weeks I have been search for examples for grabbing and frequency from an audio stream and manipulating it. So far I haven't been too successful. Just wondering if anyone has done this or has a good example of doing such. TIA Rod -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAkf9VewACgkQWtF04X/kP32peQCfX/1LgmmREFB88bdY9uzVGxb4 n+sAoJngeg2VpGpwWmJ7cJLrNmsVI9uV =rCNp -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Python Class Best Practice
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've been doing python programming for about 2 years as a hobby and now I'm finally able to use it at work in an enterprise environment. Since I will be creating the base classes and libraries I wondering which why is consider best when creating python classes: 1: class Foo(object): member1='' member2=0 def __init__(self,member1='',member2=0): self.member1 = member1 self.member2 = member2 2: class Foo(object): def __init(self,member1='',member2=0): self.member1 = member1 self.member2 = member2 - -- Rod http://roddierod.homeunix.net:8080 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHVeAscZAIaGStcnARAhRnAKCNFfjStOPGs/9tMI6bKuBQTPiJHQCdEMdY OQPSSZlJWqkLxZvPwI2ctVs= =CfvK -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Class Best Practice
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tue, 04 Dec 2007 15:51:18 -0800 Gary Herron [EMAIL PROTECTED] wrote: Rod Person wrote: 1: class Foo(object): member1='' member2=0 def __init__(self,member1='',member2=0): self.member1 = member1 self.member2 = member2 2: class Foo(object): def __init__(self,member1='',member2=0): self.member1 = member1 self.member2 = member2 Both examples will store values for member1 and member2 in every instance. Any code that accesses self.member1 (or 2) will get the value stored in the instance. Example 1 which also creates two *class* members of the same name won't affect the conclusion of the previous paragraph. The two values in the class will be shadowed by each instances members of the same name. But now I need to ask, what did you expect to happen here? Well I guess I should say that I'm coming to Python from Delphi, so I am used to creating classes like in #1, but I'm used to having to declare a scope for each member. Not having a scope declaration is really throwing me some. * If you thought those two extra assignments in example 1 effected the execution or storage in the __init__ (or any other method), you were mistaken. Yes, this is what I thought. I thought that declaring member1='' would just assign the a default value on creation of the class (as in Delphi). I probably shouldn't have give the parameters in the __init__ a default value in example 1. Gary Herron Thanks. - -- Rod http://roddierod.homeunix.net:8080 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHVeuucZAIaGStcnARAgEKAJ4/bJW9GSNTsmSgyOTokbCkEQFO7ACdErME 50Mgzge48M2z+nymifkByqo= =e3gV -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
FreeBSD/Linux X11 determine which window manager is active
I'm looking for a way to determine which window manager is running using python. I can't seem to find a system variable that hold this info. -- Rod it takes an unusual mind to see the obvious. - Alfred Whitehead signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mailman/listinfo/python-list
Help with creating processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm trying to create a simple gui wrapper for the handbrake dvd ripper with python 2.4 on a FreeBSD system. My problem is this. I want to scan the dvd to see all the titles and chapters. The handbrake command for this is: handbrake -i /dev/acd0 -t 0 I've tried: cmd = '/usr/local/bin/handbrake -i /dev/acd0 -t 0' rtn = os.popen(cmd) but the script exists before the disk has finished scanning. If I change cmd to 'ls' it work as I expected. My problem is that the scanning of the DVD can take upto a minute or more and os.popen doesn't seem to wait - although I thought it was suppose to? I've tried using subprocess.call and popen2 etc but nothing seems to wait for the return. Can someone give me a hint? - -- Rod it takes an unusual mind to see the obvious. - - Alfred Whitehead -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFsVWA3rDijyy3LEcRAia4AJ4hWZosgDeFeK4dkKdMg9ZwmAebeACfVqkQ pGiJ7pL1/d1tVszxF0kzSjQ= =Jz9+ -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list