wanna stop by my homemade glory hole?

2005-10-21 Thread kevin



hi there where are u plz 

-- 
http://mail.python.org/mailman/listinfo/python-list

The ONLY thing that prevents me from using Python

2005-08-05 Thread Kevin
I have been using java (jsp/servlets), vb/asp and perl for a few years.
Almost all my projects are web site development related, and many of my
clients' web sites are hosted on those shared web hosting services.

The problem is that it's difficult to find hosting services with Python
installed and supported. And most hosting companies are reluctant to
install it for you because they don't want to do the extra work(they
would always say to me, why don't you use php or java or asp or per?).
I have searched and found some companies that support Python. But still
there are far few choices than other options.

I am sure this issue has already been raised a billion times. I just
feel very frustrated on this. I want to learn and use Python in my web
projects.

One day in last December I decided to learn Python, because of Bruce
Eckel's  recommendation on his web site (I started java with his book).
After writing a few scripts (each with a hundred lines or less), I
really liked Python, even though at first to me, it has a very
different style and mindset from my accustomed java approach. I enjoyed
the experience and was ready to delve into the OO and other aspect of
Python.

But because of the hosting issue, I stopped and since then have spent
more time on php, and it seems that I would soon become a full time
PHPer now.

I really wish Python could be more widely available on web server
machines. This is just my own experience and I would like to hear your
comments.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The ONLY thing that prevents me from using Python

2005-08-05 Thread Kevin
Thank you all for the messages. I agree with Bill on that I was just
whining here.   I should do a bit more research.

I guess I am just getting accustomed to the endless supplies of asp/php
hosting services. All I need to do is shopping for the lowest
price/good service. But it's not the case for Python, so for a newbie
like me it's a little discouraging. Now I have more information I will
look into it, and hopefully can pick up Phthon again. To tell you the
truth, after perl, java, vb, and (some) php and groovy, I want to
settle down on something (along with java). That maybe the reason of my
frustration. :-)

-- 
http://mail.python.org/mailman/listinfo/python-list


PySQLite Table indexing inside a functions

2004-12-02 Thread Kevin
Hello Everyone,

I'm using PySQLite and would like to index this insert
statement with the 'tablename'.  Can anyone offer a
suggestion?

Also, this is a shot in the dark.  Has anyone done
anything with nested fields.  I would like each vertex
to have 3 points.  currently, I'm just making 3
fields.

Regards,
   Kevin



def PARSE2DB(data,tablename):
i = j = k = 0
cadu = GETdb().cursor()
FacetNum = len(data [1])
while i < FacetNum:
cadu.execute("""
insert into table = 'tablename'( V1_x, V1_y, V1_z,
V2_x, V2_y, V2_z,
 V3_x, V3_y, V3_z, N_x, 
N_y, N_z)
values(%f, %f, %f, %f, %f, %f, %f, %f, 
%f, %f,
%f, %f)
""",
(data [1][i][1][0][0], data [1][i][1][0][1],data
[1][i][1][0][2],
data [1][i][1][1][0], data [1][i][1][1][1],data
[1][i][1][1][2],
data [1][i][1][2][0], data
[1][i][1][2][1],data [1][i][1][2][2],
data [1][i][0][0], data
[1][i][0][1], data [1][i][0][2])
)
i = i + 1

return 




__ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PySQLite Table indexing inside a functions

2004-12-02 Thread Kevin
Hello Again,

It may be cleaner if I reduce the code:

def PARSE2DB(data,tablename):
   i = 0
   cadu = GETdb().cursor()
   FacetNum = len(data [1])
   while i < FacetNum:
   cadu.execute("""
  insert into table = 'tablename'
   ( V1_x, V1_y, V1_z)
   values(%f, %f, %f)
   """,
  (data [i][0][0], data [i][0][1]
,data[i][0][2]0])
    )
i = i + 1
   return 


--- Kevin <[EMAIL PROTECTED]> wrote:

> Hello Everyone,
> 
> I'm using PySQLite and would like to index this
> insert
> statement with the 'tablename'.  Can anyone offer a
> suggestion?
> 
> Also, this is a shot in the dark.  Has anyone done
> anything with nested fields.  I would like each
> vertex
> to have 3 points.  currently, I'm just making 3
> fields.
> 
> Regards,
>Kevin
> 
> 
> 
> def PARSE2DB(data,tablename):
> i = j = k = 0
> cadu = GETdb().cursor()
> FacetNum = len(data [1])
> while i < FacetNum:
>   cadu.execute("""
>   insert into table = 'tablename'( V1_x, V1_y,
> V1_z,
> V2_x, V2_y, V2_z,
>V3_x, V3_y, V3_z, N_x, 
> N_y, N_z)
>   values(%f, %f, %f, %f, %f, %f, %f, %f, 
> %f, %f,
> %f, %f)
>   """,
>   (data [1][i][1][0][0], data [1][i][1][0][1],data
> [1][i][1][0][2],
>   data [1][i][1][1][0], data [1][i][1][1][1],data
> [1][i][1][1][2],
>   data [1][i][1][2][0], data
> [1][i][1][2][1],data [1][i][1][2][2],
>   data [1][i][0][0], data
> [1][i][0][1], data [1][i][0][2])
>   )
>   i = i + 1
> 
> return 
> 
> 
> 
>   
> __ 
> Do you Yahoo!? 
> All your favorites on one personal page – Try My
> Yahoo!
> http://my.yahoo.com 
> 




__ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 

-- 
http://mail.python.org/mailman/listinfo/python-list


PySQLLite Speed

2004-12-02 Thread Kevin
Hello All,

I wondering if anyone has encountered the same issue
with using PySQL.  This is my first time using this DB
so this preformance may be typical.  I'm reading an
ASCII file through PyParse that contains about 1.3Meg
of Float data.  8000 Triangles (3 Vertexes and 1
Normal).  This file reads fine the PC has a
utilization of 50% for Python.  Then when it starts to
write the Database, the PC Util drops to 1-2% and it
takes forever.  I'm not PC related preformance
barriers that I'm aware of.

Regards,
   Kevin

OS : Windows
PySQLLite Version: 1.1.5





__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250
-- 
http://mail.python.org/mailman/listinfo/python-list


PySQLLite Speed

2004-12-02 Thread Kevin
Hello All,

I wanted to thank Roger Binn for his email.  He had
the answer to my issue with writing speed.  It's
actual made an incredible change in the preformace.  I
didn't have to go all the way to implementing the
synchronous mode(for my app).  Previously, I was
insert one record at a time.  The key was to write
them all at one time.  I moved up to a 13 meg file and
wrote it to the db in secs.  Now the issue is the 120
meg of RAM consumed by PyParse to read in a 13 meg
file.  If anyone has thoughts on that, it would be
great.  Otherwise, I will repost under a more specific
email.

Thanks,
  Kevin



db.execute("begin")

while i < TriNum
   db.execute("""insert into TABLE(V1_x)
values(%f),""" (data[i]))
i = i + 1

db.execute("commit")





__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problems with Tkinter

2006-01-01 Thread Kevin
Try:

fenster.title("Demofenster")

"title" a class method, not a variable.

Kevin.


"Steffen Mutter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all and a happy new year!
>
> My first try fiddling around with GUIs ended disappointing, instead of
> showing the window title as expected 'Demofenster' ist still shows 'tk'
> instead.
> What did I do wrong?
>
>
> #!/usr/bin/env python
>
> from Tkinter import *
> fenster = Tk()
> fenster.title = 'Demofenster'
> fenster.mainloop()
>
>
>
> I actually tried this running python2.4 on an Ubuntu's breezy badger
> machine and Win2kPro running Python2.3 gives the same result.
>
> Any hints highly apprechiated.
>
> Regards,
> Steffen
>


-- 
http://mail.python.org/mailman/listinfo/python-list


How can I determine an HTTPMessage ?

2006-01-11 Thread Kevin
Can you tell me what to look for in an HTTPMessage that is an error?  I
have looked at the header objects and I cannot determine an error
message.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: two questions about thread

2006-01-15 Thread Kevin
The best way to do this is by using a flag or event that the child-threads
monitor each loop (or multiple times per loop if it's a long loop).  If the
flag is set, they exit themselves.

The parent thread only has to set the flag to cause the children to die.

Kevin.


"Bryan Olson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> iclinux wrote:
> > a.  how to exit the whole process in a thread?
> > b. when thread doing a infinite loops, how to terminate the process?:
>
> As others noted, the threading module offers Thread.setDaemon.
> As the doc says: "The entire Python program exits when no active
> non-daemon threads are left."
>
> Python starts your program with one (non-daemon) thread which
> is sometimes called the "main" thread. I suggest creating all
> other threads as daemons. The process will then exit when the
> main thread exits.
>
> If some other thread needs to end the process, it does so by
> telling the main thread to exit. For example, we might leave
> the main thread waiting at a lock (or semaphore), and exit if
> the lock is ever released.
>
>
>  > it seems that the follow doesn't work, in my Windows XP:
>  > thread.start()
>  > thread.join()
>
> Is that part of the questions above, or another issue?
>
>
> -- 
> --Bryan


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Placing graphics & text on printed page - jan06call.jpg (0/1)

2006-01-15 Thread Kevin
One option is to create your page as an image file using PIL (which can
handle your text and drawing requirements, as well as any
pictures/graphics), then print it to a windows printer using my
ImagePrintWin module.

ImagePrintWin can print to any normal windows printer, and includes an
optional GUI for doing a "Printer Setup" type dialog (including preview).
It can even handle ICC profiles for your printer if you want color accuracy.

You can download ImagePrintWin (GPL'd) from my site at:

http://www.cazabon.com/python/downloads/ImagePrintWin.py


The pyCMS module for doing ICC is available also on my site at:

http://www.cazabon.com/pyCMS/

Kevin Cazabon.

"Michael Galvin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to use Python to send to the printer a calender filled
> with a mix of text and simple graphics.  I want to draw on the printed
> page something like a table with 6 rows and 7 columns to represent a
> calendar.  I want to place text precisely within those boxes on the
> printed page. I am using Python 2.4 on Windows XP
>
> I was  in the past able to do this within Visual Basic using its
> printer object.  Visual Basic's printer object uses a coordinate
> system to allow you to draw lines and to place text on the printed
> page precisely. I have attached a file "jan06call.jpg" to this message
> to illustrate what I am trying to do.
>
> Does Python have a module which would help me do this?
>
> To put it another way, can Python control the placement of text and
> graphics precisely on the printed page?
>
> I have scoured my Python programming texts,  python.org, and this
> usenet group without success.  Mark Lutz's wonderful book "Programming
> Python"  has not one reference to the word "printer" in its index.
> Surely, I must be overlooking something or thinking about this wrong.
>
> Michael Galvin
> Muskegon, MI
>


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I determine an HTTPMessage ?

2006-01-19 Thread Kevin
Thanks,  I was trying to get it to work with urllib instead of urllib2.
 The code below works.  Thanks.

import urllib2 as myurl

url = "some url"

try:
myurl.urlopen(url)
print "Redirecting to %s\n" % url
return url
except:
print "An invalid login_query was specified.  Redirecting to
prefedit.psp with an error message.\n"
return "prefedit.psp?uname=%s&err=Invalid%%20login%%20query."
%(username)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem of Readability of Python

2007-10-10 Thread Kevin
Am I missing something, or am I the only one who explicitly declares
structs in python?

For example:
FileObject = {
"filename" : None,
"path" : None,
}

fobj = FileObject.copy()
fobj["filename"] = "passwd"
fobj["path"] = "/etc/"

Kevin Kelley

On 10/7/07, Licheng Fang <[EMAIL PROTECTED]> wrote:
> Python is supposed to be readable, but after programming in Python for
> a while I find my Python programs can be more obfuscated than their C/C
> ++ counterparts sometimes. Part of the reason is that with
> heterogeneous lists/tuples at hand, I tend to stuff many things into
> the list and *assume* a structure of the list or tuple, instead of
> declaring them explicitly as one will do with C structs. So, what used
> to be
>
> struct nameval {
> char * name;
>int val;
> } a;
>
> a.name = ...
> a.val = ...
>
> becomes cryptic
>
> a[0] = ...
> a[1] = ...
>
> Python Tutorial says an empty class can be used to do this. But if
> namespaces are implemented as dicts, wouldn't it incur much overhead
> if one defines empty classes as such for some very frequently used
> data structures of the program?
>
> Any elegant solutions?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Kevin Kelley
http://technogeek.org/
-- 
http://mail.python.org/mailman/listinfo/python-list


Using Timing function problem.....

2007-01-24 Thread kevin
Hi... I'm having a few problems here...
I want to input in my function different values and then time each one
to see how long it took to run the function... so right now it doesn't
like the "i" inside my function fibonacci(i)  but if I put a constant
it's fine
any idea on how to approach this?
thanks!
Jonathan

The Code:
===

for i in (range(1,30)):
mytime1 = timeit.Timer( 'fibonacci(i)', 'from prl1 import
fibonacci' )
mytime2 = timeit.Timer( 'fibonacci(i)', 'from prl2 import
fibonacci' )

fib1 = mytime1.timeit(1)
fib2 = mytime2.timeit(1)

===

The Error:
===
Traceback (most recent call last):
  File "prl3.py", line 23, in ?
fib1 = mytime1.timeit(1)
  File "/usr/lib64/python2.4/timeit.py", line 161, in timeit
timing = self.inner(it, self.timer)
  File "", line 6, in inner
NameError: global name 'i' is not defined
===

-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: [PyQt] Popen + poll & pid

2008-03-08 Thread Kevin
Hi, I sent the question below to the wrong list.  I was wondering if  
someone here could help?


Kevin

Sent from my iPhone

Begin forwarded message:


From: Kevin <[EMAIL PROTECTED]>
Date: March 8, 2008 11:53:39 AM PST
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: [PyQt] Popen + poll & pid



I've been trying to use the poll and pid attributes of popen to  
determine if mplayer is finished playing an audio track. I've tried  
using popen, popen2, popen3, etc but it tells me that there is no  
poll or PID module.


Could anyone help me with a proper method to determine if a process  
is running or ended so that I can move to the next track and start  
another iteration?


Either that or does someone know how to change audio cd tracks in  
mplayer slave mode?  ;)


Kevin


Sent from my iPhone
___
PyQt mailing list[EMAIL PROTECTED]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: driver detective crack keygen

2008-05-31 Thread kevin
Hi i was wondering if you did find a keygen or crack for driver 
detective if so could you please help me in my serach for the same . kevin


--
http://mail.python.org/mailman/listinfo/python-list


Problem with smtplib and py2exe

2008-04-07 Thread Kevin
Hi everyone,

I'm running Python 2.5.1 on an XP-Pro platform, with all the updates
(SP2, etc) installed. I have a program (send_file.py) that sends a
file to a service provider, using an ftp connection.  The program
works properly, and I've created an 'exe' of it, using py2exe.  It was
distrubuted to my user base a couple of weeks ago and seems to be
working well.  None of the users have Python installed on their
machines, thus the need for an 'exe' for the program.

I now need to add an email function to the program, to automatically
send an email to a select user list when the program is completed.
I've made the appropriate modifications to my code, and the program
works properly when I run it from Python.  When I try to make an exe
out of my new program, however, I get the following error:

Traceback (most recent call last):
  File "C:/Python25/send_ftp/setup.py", line 17, in 
console = [{"script": 'send_file.py'}] )
  File "C:\Python25\lib\distutils\core.py", line 168, in setup
raise SystemExit, "error: " + str(msg)
SystemExit: error: command 'C:\Python25\pythonw.exe' failed with exit
status 1

The 'setup.py' script is the same one I used to generate the 'exe' of
the original program. The email-related code was added to my
'send_file.py' program as a function - it's not a separate module.  If
all of the changes are commented out, the py2exe function works. But
as soon as I activate even the line "import smtplib", the py2exe
process spits out the error above.

If I put only the email portions of code in a test program, and run it
from Python, it works, but if I try make an 'exe' out of the test
program, I get the same error as above.

Is there an inherent incompatibility between smtplib and py2exe? Does
anyone have any ideas of how I can fix this problem?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with smtplib and py2exe

2008-04-08 Thread Kevin
Thanks, Terry, you pointed me in the right direction with the
reference to the "DEBUG".

I dug out my "Learning Python" book, to read up on the debugger, and
one of the things I came across was a section on IDLE's debugger. It
said essentially that if you get an error that doesn't make sense when
you're trying to run another program (in this case, py2exe) with IDLE,
then run the program from the command line instead.  I did that, and
much to my surprise, I was able to generate the 'exe' that I needed.

I guess the incompatibility isn't necessarily between 'py2exe' and
'smtplib' after all, but between 'py2exe' and 'IDLE'.
-- 
http://mail.python.org/mailman/listinfo/python-list


calling another python file within python

2006-03-14 Thread Kevin
i have a python file called pyq which outputs stock quotes, currently i 
also have a html file that takes stock ticker inputs, i would like to 
bridge the two by building another program that takes the html inputs 
and uses them to call the pyq stock ticker program and then output them 
into a text file...

any idea how to do this? my tentative code is:



#!/usr/bin/python

import os
import urllib
os.system("python pyq.py ibm > text1.txt")




note: currently the text1.txt outputted is just blank, however if i run 
the command normally as 'python pyq.py ibm' in the command line, it 
works correctly and gives me the price of ibm.
-- 
http://mail.python.org/mailman/listinfo/python-list


Error in compiling Python on OS X

2009-07-26 Thread Kevin
I am trying to compile Python 2.6.2 on Mac OS X 10.5.7.  I have Xcode
3.1.3 installed.

The error I got is below.

$ ./configure --prefix=/Users/me/python
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking machine type as reported by uname -m... i386
checking for --without-gcc... no
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.

Please send any ideas.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Error in compiling Python on OS X

2009-07-27 Thread Kevin
On Jul 26, 3:46 pm, "Diez B. Roggisch"  wrote:
> Kevin schrieb:
>
> > I am trying to compile Python 2.6.2 on Mac OS X 10.5.7.  I have Xcode
> > 3.1.3 installed.
>
> > The error I got is below.
>
> > $ ./configure --prefix=/Users/me/python
>
> Use a framework-build.
>
> > checking for --with-universal-archs... 32-bit
> > checking MACHDEP... darwin
> > checking EXTRAPLATDIR... $(PLATMACDIRS)
> > checking machine type as reported by uname -m... i386
> > checking for --without-gcc... no
> > checking for gcc... gcc
> > checking for C compiler default output file name...
> > configure: error: C compiler cannot create executables
> > See `config.log' for more details.
>
> > Please send any ideas.
>
> What happens if you write a simple test.c like this:
>
> int main() {
>     return 0;
>
> }
>
> and compile it with gcc on the commandline? There must be a file called
> "a.out" afterwards.
>
> diez

I have solved my problem.  I think something was wrong with my
compiler.  After I installed Xcode again, I was able to compile with
no problems.
-- 
http://mail.python.org/mailman/listinfo/python-list


MySQL Database

2013-05-08 Thread Kevin Holleran
Hello,

I want to connect to a MySQL database, query for some records, manipulate
some data, and then update the database.

When I do something like this:

db_c.execute("SELECT a, b FROM Users")

for row in db_c.fetchall():

(r,d) = row[0].split('|')

(g,e) = domain.split('.')

db_c.execute("UPDATE Users SET g = '" + g + "' WHERE a ='" + row[0])

Will using db_c to update the database mess up the loop that is cycling
through db_c.fetchall()?

Thanks for your help.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL Database

2013-05-08 Thread Kevin Holleran
On Wed, May 8, 2013 at 2:56 PM, Chris Angelico  wrote:

> On Thu, May 9, 2013 at 4:52 AM, Kevin Holleran  wrote:
> > Will using db_c to update the database mess up the loop that is cycling
> > through db_c.fetchall()?
>
> Nope; fetchall() returns a list, which you're then iterating over.
> Nothing the database does can disrupt that.
>
> ChrisA
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Awesome.  That was my hope...

Thanks for your help & quick response.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL Database

2013-05-08 Thread Kevin Holleran
Thanks,  I actually intend to, was just whipping something up to be an
example for my question.



--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
GCFA, GCFE, CCNA, ISA, MCSA, MCDST, MCP

"Do today what others won't, do tomorrow what others can't" - SEALFit

"We are what we repeatedly do. Excellence, then, is not an act, but a
habit." - Aristotle


On Wed, May 8, 2013 at 3:07 PM, MRAB  wrote:

> On 08/05/2013 19:52, Kevin Holleran wrote:
>
>> Hello,
>>
>> I want to connect to a MySQL database, query for some records,
>> manipulate some data, and then update the database.
>>
>> When I do something like this:
>>
>>  db_c.execute("SELECT a, b FROM Users")
>>
>> for row in db_c.fetchall():
>>
>>  (r,d) = row[0].split('|')
>>
>>  (g,e) = domain.split('.')
>>
>>  db_c.execute("UPDATE Users SET g = '"+ g + "' WHERE a ='"+
>> row[0])
>>
>>
>> Will using db_c to update the database mess up the loop that is cycling
>> through db_c.fetchall()?
>>
>>  You shouldn't be building an SQL string like that because it's
> susceptible to SQL injection. You should be doing it more like this:
>
> db_c.execute("UPDATE Users SET g = %s WHERE a = %s", (g, row[0]))
>
> The values will then be handled safely for you.
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to run another file inside current file?

2013-05-18 Thread Kevin Xi
Hi,
It's better to specify version of python you work with. I know nothing
about python 3 but in python 2 you can do this with `exec`. Example:

> f = file('otherFile.py')
> exec f

For more, read the doc:
http://docs.python.org/2.7/reference/simple_stmts.html#the-exec-statement
HTH


   Kevin

2013/5/18 Avnesh Shakya 

> hi,
>I want to run a another file inside a ached.add_cron_job(..). how is it
> possible, please help me, I have a file otherFile.py for execution inside
> current file.
> I know it is very easy question but i m unable to get anything, please
> help me.
> example --
>
> import otherFile
> from apscheduler.scheduler import Scheduler
> sched = Scheduler()
> sched.start()
>
> def job_function():
> # Can I here add that file for execution, Or can i add that file
> directly inside cron?
>
> sched.add_cron_job(job_function, month='1-12', day='1-31',
> hour='0-23',minute='44-49')
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
让我们忠于理想,让我们面对现实。
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Future standard GUI library

2013-05-18 Thread Kevin Walzer
 Python's stdlib in 
years. You are quite safe in developing against this API, unless your 
taste simply does not run to using the ttk widgets.


Hope this helps,
Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Future standard GUI library

2013-05-19 Thread Kevin Walzer

On 5/18/13 11:01 PM, llanitedave wrote:

I'm curious about how commonly tkinter is actually used among Python app 
developers as compared to wx, Pyside, or PyQT.  I get the impression that more 
distributed apps are built with wxPython, at least, than tkinter.  My 
impression is far from actual knowledge, of course.



I have two commercial apps developed with Tkinter:

http://www.codebykevin.com/phynchronicity.html
http://www.codebykevin.com/quickwho.html

--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: any cherypy powred sites I can check out?

2013-05-19 Thread Kevin Walzer

On 5/16/13 2:30 PM, Chris Angelico wrote:

On Fri, May 17, 2013 at 4:17 AM,   wrote:

anyone?
--
http://mail.python.org/mailman/listinfo/python-list


You're firing off a bunch of minimal-content threads that ask other
people to do work for you. I recommend you put a bit more thought into
your posts, and show that you're willing to do a basic web search
before you just ask a question :)



He's also known on the Tcl newsgroup as Gavino; a Google search for 
"gavino tcl" will turn up some interesting hits. I also see that he's 
posting on comp.lang.perl as "Johannes Falcone." The common thread of 
his recent postings are subjects posed as questions, usually about 
various web frameworks, sometimes without even a single line in the 
message body. On the Tcl list it's AOLServer and NavServer. I'm not 
familiar with the Perl frameworks he's curious about.


--Kevin


--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Future standard GUI library

2013-05-20 Thread Kevin Walzer

On 5/20/13 1:04 AM, Vito De Tullio wrote:

FLTK? (http://www.fltk.org/index.php)


FLTK is even uglier than non-themed Tkinter: non-native on every 
platform. Tkinter wraps native widgets on MacOS and WIndows, but FLTK 
draws its own widgets everywhere.


--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread Kevin Xi
On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote:
> Hi,
> 
Hi,
> 
> I'm just starting out with Python and to practice I am trying to write a 
> script that can have a simple conversation with the user.
> 
So you may want to search the doc before you ask: http://docs.python.org
> 
> When I run the below code, it always ends up printing response to "if age > 
> 18:" -- even if I enter a value below 18.
> 
> 
> 
> Can anyone point me to what I am doing wrong?  Many thanks in advance.
> 
> 
> 
> age=raw_input('Enter your age: ')
> 
> if age > 18:
> 
> print ('Wow, %s. You can buy cigarettes.' % age)
> 
> else:
> 
> print ('You are a young grasshopper.')

You can either use `raw_input` to read data and convert it to right type, or 
use `input` to get an integer directly. Read this: 
http://docs.python.org/2/library/functions.html#raw_input
http://docs.python.org/2/library/functions.html#input

 Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Kevin Xi
Oh yes, you guys are right. Thank you very much for warning me that.

On Thursday, May 23, 2013 6:31:04 AM UTC+8, Alister wrote:

> 
> as Chris A point out it executes user input an can cause major damage 
> 
> (reformatting the hard disk is not impossible!)
> 

It definitely can cause major damage! I try to input `os.system('rm -rf *')` 
and it really delete all stuff under the directory:(, I have never realized it 
can do that harm. Sorry for misleading you C. N. Desrosiers.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re-using copyrighted code

2013-06-09 Thread Kevin Walzer

On 6/8/13 5:31 PM, Malte Forkel wrote:

Now, how am I supposed to deal with that? Ask Secret Labs for some kind
of permission? Leave it as it is and add my own copyright line?


Secret Labs AB is Frederic Lundh, author of the Python Image Library and 
many bits included in Python's stdlib. Here is info about him:


http://effbot.org/zone/about.htm

His contact info is listed here:

http://www.pythonware.com/company/contact.htm

I have trouble believing there would be any issue with you re-using the 
code, especially since it is included with Python's stdlib.


--Kevin
--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem creating a regular expression to parse open-iscsi, iscsiadm output (help?)

2013-06-13 Thread Kevin LaTona

On Jun 12, 2013, at 5:59 PM, rice.cr...@gmail.com wrote:


> I am parsing the output of an open-iscsi command that contains several blocks 
> of data for each data set. Each block has the format:
>  Lastly, a version of this regex as a non-VERBOSE expression works as 
> expected.. Something about re.VERBOSE... 
Snip


With the following code tweaks in Python 2.7.2, I find it works with VERBOSE 
for me, but not without.

I would say the regex could still use some more adjustments yet.

-Kevin





import re

inp ="""
Target: iqn.1992-04.com.emc:vplex-8460319f-0007
   Current Portal: 221.128.52.224:3260,7
   Persistent Portal: 221.128.52.224:3260,7
   **
   Interface:
   **
   Iface Name: default
   Iface Transport: tcp
   Iface Initiatorname: iqn.1996-04.de.suse:01:7c9741b545b5
   Iface IPaddress: 221.128.52.214
   Iface HWaddress: 
   Iface Netdev: 
   SID: 154
   iSCSI Connection State: LOGGED IN
   iSCSI Session State: LOGGED_IN
   Internal iscsid Session State: NO CHANGE
"""

regex = re.compile( r'''
 # Target name, iqn
  Target:\s+(?P\S+)\s*
  # Target portal
  \s+Current\sPortal:\s*
  (?P\w+\.\w+\.\w+\.\w+):(?P\d+),(?P\d+)
  # skip lines...
  [\s\S]*?
  # Initiator name, iqn
  Iface\s+Initiatorname:\s+(?P\S+)\s*
  # Initiator port, IP address
  Iface\s+IPaddress:\s+(?P\S+)
  # skip lines...
  [\s\S]*?
  # Session ID
  SID:\s+(?P\d+)\s*
  # Connection state
  iSCSI\ +Connection\ +State:\s+(?P\w+\s*\w*)
  [\s\S]*?
  # Session state iSCSI
  iSCSI\s+Session\s+State:\s+(?P\w+)\s*
  # Session state Internal
  Internal\s+iscsid\s+Session\s+State:.*\s+(?P\w+\s\w+)
   ''', re.VERBOSE|re.MULTILINE)

myDetails = [ m.groupdict() for m in regex.finditer(inp)][0]
for k,v in myDetails.iteritems():
   print k,v




#*

If you want just the values back in the order parsed this will work for now.


for match in regex.findall(inp):
  for item in range(len(match)):
print match[item]



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem creating a regular expression to parse open-iscsi, iscsiadm output (help?)

2013-06-14 Thread Kevin LaTona

On Jun 13, 2013, at 7:42 AM, Kevin LaTona  wrote:
> With the following code tweaks in Python 2.7.2, I find it works with VERBOSE 
> for me, but not without.


Sorry had a small bleep while writing that last line this AM.

Of course the regex pattern would work in VERBOSE mode as that was how it was 
presented.

Without VERBOSE each line of the pattern would of needed to have been enclosed 
in quote or double quote marks.


http://docs.python.org/2/library/re.html#re.VERBOSE


-Kevin




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona



>>Queries should be URL encoded; query string should be enclosed in %27 
>>(apostrophe).

I was looking at the wrong column on the ascii chart,… so your %27 was correct

If you are getting in via a browser than it's url lib thing.

You might want to look at Requst lib as a possible option.

http://docs.python-requests.org/en/latest/


-Kevin



On Jun 13, 2013, at 2:31 PM, Yves S. Garret  wrote:

> This is the format that I've been following:
> http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/
> 
> If I execute the specified query from a browser, the JSON file
> shows up without a problem.  Now, I'd like to do that programmatically.
> 
> 
> On Thu, Jun 13, 2013 at 4:57 PM, Yves S. Garret  
> wrote:
> Hello all,
> 
> This is my dilemma, I'm trying to get the generated JSON file using the bing 
> api 
> search.
> 
> This is the code that I'm executing from inside the shell:
> http://bin.cakephp.org/view/460660617
> 
> The port doesn't matter to me.  Thoughts?
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona

I did a quick test with url lib instead of urllib2 and got closer.

Problem right now is without ID code I can't check any further.

But it does look promising at this point.


If all else fails http://docs.python.org/2/library/urllib.html#examples


import urllib

f = 
urllib.urlopen('https://user:...@api.datamarket.azure.com/Bing/SearchWeb/Web?Query=%27xbox%20one%27&$top=50&$format=JSON')

print f.read()



IOError: ('http error', 401, 'The authorization type you provided is not 
supported.  Only Basic and OAuth are supported',





On Jun 13, 2013, at 2:31 PM, Yves S. Garret  wrote:

> This is the format that I've been following:
> http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/
> 
> If I execute the specified query from a browser, the JSON file
> shows up without a problem.  Now, I'd like to do that programmatically.
> 
> 
> On Thu, Jun 13, 2013 at 4:57 PM, Yves S. Garret  
> wrote:
> Hello all,
> 
> This is my dilemma, I'm trying to get the generated JSON file using the bing 
> api 
> search.
> 
> This is the code that I'm executing from inside the shell:
> http://bin.cakephp.org/view/460660617
> 
> The port doesn't matter to me.  Thoughts?
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Having a hard time to 'get' bing api search results

2013-06-14 Thread Kevin LaTona


Your welcome.


To be honest I am not 100% on the differences between.

I could be off, but I recall urllib2 was a more refined version of urllib.

Yet it seems like urllib works better for me, when I need to do a simple call 
like this.


-Kevin



On Jun 13, 2013, at 3:50 PM, "Yves S. Garret"  
wrote:

> That works beautifully!  Thank you!
> 
> I do have one question, what are urllib and urllib2 then?  I figured that
> urllib2 is a newer version of the previous library (and one that I should
> be using).  Am I missing something?
> 
> 
> On Thu, Jun 13, 2013 at 6:45 PM, Kevin LaTona  wrote:
> 
> I did a quick test with url lib instead of urllib2 and got closer.
> 
> Problem right now is without ID code I can't check any further.
> 
> But it does look promising at this point.
> 
> 
> If all else fails http://docs.python.org/2/library/urllib.html#examples
> 
> 
> import urllib
> 
> f = 
> urllib.urlopen('https://user:...@api.datamarket.azure.com/Bing/SearchWeb/Web?Query=%27xbox%20one%27&$top=50&$format=JSON')
> 
> print f.read()
> 
> 
> 
> IOError: ('http error', 401, 'The authorization type you provided is not 
> supported.  Only Basic and OAuth are supported',
> 
> 
> 
> 
> 
> On Jun 13, 2013, at 2:31 PM, Yves S. Garret  
> wrote:
> 
>> This is the format that I've been following:
>> http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/
>> 
>> If I execute the specified query from a browser, the JSON file
>> shows up without a problem.  Now, I'd like to do that programmatically.
>> 
>> 
>> On Thu, Jun 13, 2013 at 4:57 PM, Yves S. Garret  
>> wrote:
>> Hello all,
>> 
>> This is my dilemma, I'm trying to get the generated JSON file using the bing 
>> api 
>> search.
>> 
>> This is the code that I'm executing from inside the shell:
>> http://bin.cakephp.org/view/460660617
>> 
>> The port doesn't matter to me.  Thoughts?
>> 
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list
> 
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Tonight's meeting + s Database link

2013-06-17 Thread Kevin LaTona


First off what a fun meeting it was tonight with a great conversation.

Let's do more of them.



Next this is the link to that JSON Database I mentioned but could not recall 
the name on.

http://www.rethinkdb.com/




RethinkDB overview

RethinkDB is built to store JSON documents, and scale to multiple machines with 
very little effort. 

It has a pleasant query language that supports really useful queries like table 
joins and group by, and is easy to setup and learn.

See the highlights of RethinkDB 


Simple programming model:
• JSON data model and immediate consistency.
• Distributed joins, subqueries, aggregation, atomic updates.
• Secondary, compound, and arbitrarily computed indexes.
• Hadoop-style map/reduce.


Easy administration:
• Friendly web and command-line administration tools.
• Takes care of machine failures and network interrupts.
• Multi-datacenter replication and failover.


Horizontal scalability:
• Sharding and replication to multiple nodes.
• Queries are automatically parallelized and distributed.
• Lock-free operation via MVCC concurrency.


RethinkDB compared to other databases:
• Read the FAQ for information on architectural tradeoffs.
• Find out how RethinkDB compares to MongoDB.
• See our take on what makes RethinkDB different.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tonight's meeting + s Database link -- Sorry

2013-06-17 Thread Kevin LaTona


Sorry all, I managed to send that last email to wrong Python list.


-Kevin


On Jun 17, 2013, at 10:55 PM, Kevin LaTona  wrote:

> 
> 
> First off what a fun meeting it was tonight with a great conversation.
> 
> Let's do more of them.
> 
> 
> 
> Next this is the link to that JSON Database I mentioned but could not recall 
> the name on.
> 
> http://www.rethinkdb.com/
> 
> 
> 
> 
> RethinkDB overview
> 
> RethinkDB is built to store JSON documents, and scale to multiple machines 
> with very little effort. 
> 
> It has a pleasant query language that supports really useful queries like 
> table joins and group by, and is easy to setup and learn.
> 
> See the highlights of RethinkDB 
> 
> 
> Simple programming model:
>   • JSON data model and immediate consistency.
>   • Distributed joins, subqueries, aggregation, atomic updates.
>   • Secondary, compound, and arbitrarily computed indexes.
>   • Hadoop-style map/reduce.
> 
> 
> Easy administration:
>   • Friendly web and command-line administration tools.
>   • Takes care of machine failures and network interrupts.
>   • Multi-datacenter replication and failover.
> 
> 
> Horizontal scalability:
>   • Sharding and replication to multiple nodes.
>   • Queries are automatically parallelized and distributed.
>   • Lock-free operation via MVCC concurrency.
> 
> 
> RethinkDB compared to other databases:
>   • Read the FAQ for information on architectural tradeoffs.
>   • Find out how RethinkDB compares to MongoDB.
>   • See our take on what makes RethinkDB different.
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stack Overflow moderator “animuson”

2013-07-19 Thread Kevin Walzer

On 7/10/13 3:55 AM, Mats Peterson wrote:

A moderator who calls himself “animuson� on Stack Overflow doesn’t
want to face the truth. He has deleted all my postings regarding Python
regular expression matching being extremely slow compared to Perl.
Additionally my account has been suspended for 7 days. Such a dickwad.

Mats



And we should care because...?

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-22 Thread Kevin Walzer

On 7/22/13 4:54 AM, Cucole Lee wrote:

Why Thinter? You can try wxpython.



Well, it's partly a matter of taste, but I for one find wxPython's 
API...inelegant.


--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Kevin Walzer

On 7/21/13 10:42 AM, Gilles wrote:

Hello

Every once in a while, my ISP's SMTP server refuses to send
perfectly legit e-mails because it considers them as SPAM.

So I'd like to install a dead-simple SMTP server on my XP computer
just to act as SMTP backup server.
All I'd need is to change the SMTP address in my e-mail client, and
off they go. No need for anything else like user authentication or
SPAM control.

Is there a no-brainer, ready-to-use solution in Python that I could
use for this?

Thank you.



http://www.hmailserver.com

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-24 Thread Kevin Walzer

On 7/23/13 5:53 PM, Gilles wrote:

On Mon, 22 Jul 2013 10:14:15 -0400, Kevin Walzer 
wrote:

http://www.hmailserver.com


Thanks. hMailServer was one of the apps I checked, and I was just
making sure there weren't something simpler, considering my needs,
ideally something like Mongoose MTA.

Regardless, because of the SPAM anti-measures mentioned above, it
seems like I was over-optimistic about running an MTA and sending
e-mails from my home computer :-/



The reason I mentioned hMailServer is that I host my own mail server for 
my business--I have a static IP address, and correctly configured 
DNS--and so I'm able to send out large batches of e-mails to customers 
from my network without being blocked by my ISP. I'm running a Mac 
server so my mail system is the typical Unix setup (Postfix, etc.), but 
hMailServer was the closest thing I've found for Windows.


Configuring your own server isn't cheap in terms of time even if you use 
FOSS components, and your ISP may charge more for a static IP, so I 
completely understand if you don't want to go that route.


--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Cross-Platform Python3 Equivalent to notify-send

2013-07-27 Thread Kevin Walzer

On 7/27/13 6:58 AM, Devyn Collier Johnson wrote:

Linux systems with the proper software can use the "notify-send"
command. Is there a cross-platform Python3 equivalent?

Mahalo,

Devyn Collier Johnson
devyncjohn...@gmail.com


http://pythonhosted.org/gntp/ ?

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to package embedded python?

2013-07-29 Thread Kevin Walzer

On 7/25/13 5:05 PM, David M. Cotter wrote:

what must i include in my app package if i'm embedding python?

i tried including *everything* in the "DLLs" directory, but my app still 
crashes as soon as i attempt to initialize python.

this is on a system that does not have python installed, as most of my users 
won't have it.  is it actually a requirement that they first install python?  
(cuz it does work then)



Have you looked at these docs?

http://docs.python.org/2/extending/embedding.html

Lots of other hits on Google for ""embedding Python in C app."

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
http://mail.python.org/mailman/listinfo/python-list


unittest - sort cases to be run

2012-08-21 Thread Kevin Zhang
Hi all,

I want to sort the order of the unittest cases to be run, but found such
statement in Python doc,
"Note that the order in which the various test cases will be run is
determined by sorting the test function names with respect to the built-in
ordering for strings."

s.addTest(BTest())
s.addTest(ATest())
TextTestRunner().run(ts)

I need BTest() to be run prior to ATest(), is there any natural/beautiful
way to achieve this? Thanks,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Kevin Walzer

On 8/31/12 6:18 AM, Arnaud Delobelle wrote:

I'm very inexperienced with Tkinter (I've never used it before).  All
I'm looking for is a workaround, i.e. a way to somehow suppress that
output.


What are you trying to do? Navigate the focus to another widget? You 
should use the tab bar for that, not the arrow key. The entry widget is 
a single-line widget, and doesn't have up/down as the text widget does.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Kevin Walzer

On 8/31/12 11:18 AM, Arnaud Delobelle wrote:



I'm not trying to do anything.  When a user presses the UP or DOWN
arrow, then a strange character is inserted in the Entry box.  I'd
rather nothing happened.

Why is the user doing that? If they are trying to navigate to a 
different part of the interface, they need to use the tab key, not the 
arrow key. It's not a multi-line text widget and shouldn't be expected 
to work like one.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading a file in IDLE 3 on Mac-Lion

2012-09-23 Thread Kevin Walzer

On 9/23/12 3:33 AM, Ned Deily wrote:

This appears to a difference in behavior between Carbon Tk 8.4 and Cocoa
Tk 8.5 on OS X.  The python.org 32-bit-only installers are built to link
with the former and, with 8.4, the Open file dialog box does have the
file-type filter menu as Hans describes.  The python.org 64-/32-bit
installers link with the newer Cocoa Tk 8.5 and, with it, the Open file
dialog box does not have the filter menu.  I'm not sure there is
anything that IDLE or Tkinter can do about that; any change may need to
be by the Tcl/Tk folks.  But it would be good if you would open an issue
at bugs.python.org so we can follow up on it.


It's a function of NSOpenPanel, the underlying native dialog that 
supports the "open file" dialog on OS X. It doesn't have a "file filter" 
capability, and so it will only recognize hard-coded types that are 
passed to it, cf. py and txt files. "dat" isn't recognized, I tested it 
out. There's nothing to do here; it's an aspect of the native dialog.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading a file in IDLE 3 on Mac-Lion

2012-09-23 Thread Kevin Walzer

On 9/23/12 8:45 AM, Kevin Walzer wrote:

There's nothing to do here; it's an aspect of the native dialog.


To clarify: there's nothing to do at the C level, which is where the 
native dialog is invoked. IDLE can probably be patched to accept other 
file types, such as "dat."


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Article on the future of Python

2012-09-25 Thread Kevin Walzer

On 9/25/12 4:15 AM, Mark Lawrence wrote:

Hi all,

I though this might be of interest.

http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-python



Interesting article, but the comments of those who say "the only 
language I need to know is Python" strike me as a bit limited. If this 
is the case, then Python can never be moved forward, because it is 
written in C.


I program in Python, C, Objective C, JavaScript, Tcl, AppleScript, and 
I'm learning Perl. Python could *not* handle all the domains I target in 
my projects. For instance: if I want to access Mac-native functionality 
via Tkinter that isn't currently available in the library, I have to 
drill down into C or Objective-C, write a wrapper that hooks in to the 
primitives via Tcl's C API, then possibly write some additional Tcl code 
to provide a cleaner interface, *then* write some kind of Python wrapper 
that I can access in my Tkinter app.


I can understand loving the language and wanting to work just in the 
language, but it's another thing entirely to call Python the One 
Language to Rule Them All. (That's C, because all other languages are 
implemented in it. :-) )


--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Article on the future of Python

2012-09-26 Thread Kevin Walzer

On 9/25/12 11:35 AM, Steven D'Aprano wrote:

IronPython in C#. Jython is written in Java. CLPython is written in Lisp.
Berp and HoPe are written in Haskell. Nuitka is written in C++. Skulpt is
written in Javascript. Vyper is written in Ocaml. PyPy is written in
RPython.

Some of those Python compilers are obsolete, unmaintained or
experimental. Others are not. But either way, it is certainly not true
that Python is written in C. One specific Python compiler happens to be
written in C, that is all.


Apart from IronPython, what constituency do these alternative 
implementations of Python have that would raise them above the level of 
interesting experiments?


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Compairing filenames in a list

2012-09-29 Thread Kevin Anthony
I have a list of filenames, and i need to find files with the same
name, different extensions, and split that into tuples.  does anyone have
any suggestions on an easy way to do this that isn't O(n^2)?

-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE Crashing in Mac OS 10.8.2 with 2.7.3

2012-10-09 Thread Kevin Walzer

On 10/9/12 11:27 AM, bkee...@gmail.com wrote:

I've tried all the usual suspect of uninstalling and reinstalling IDLE and 
Python 2.7.3, but my IDLE environment always crashes unexpectedly on Mac OS X 
10.8.


Where did you get Python? What version of Tcl/Tk do you have installed? 
Is it the one from ActiveState or the one bundled with OS X?


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


__setitem__ without position

2012-10-11 Thread Kevin Anthony
I have a class that contains a list of items
I can set items using __setitem__ but if i want to set the while list, i
changes the variable from a myclass to a list.  How can i accomblish this
Example
>>>C = myclass()
>>>C[0] = 57
>>>type(C)
myclass
>>> C = [57,58,59,60]
>>>type(C)
list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __setitem__ without position

2012-10-11 Thread Kevin Anthony
I'm not supprised... and understand why it's happening.  I'm asking how to
get around it.

Basically i'm asking how to override, if i can, the `=`



On Thu, Oct 11, 2012 at 5:32 PM, Dave Angel  wrote:

> On 10/11/2012 04:48 PM, Kevin Anthony wrote:
> > I have a class that contains a list of items
> > I can set items using __setitem__ but if i want to set the while list, i
> > changes the variable from a myclass to a list.  How can i accomblish this
> > Example
> >>>> C = myclass()
> >>>> C[0] = 57
> >>>> type(C)
> > myclass
> >>>> C = [57,58,59,60]
> This creates a list, and binds the name that used to refer to the
> myclass to now refer to the list.  The myclass object will go away,
> since there are no more refs to it.
>
> >>>> type(C)
> > list
> >
> >
> Why is that a surprise?
>
> As for how to add multiple items to the existing mylist, how about:
>
> for index, item in enumerate([57, 50, 59, 60]) :
> C[index] = item
>
> Alternatively, you could call one of the other methods in the class.
> But since you gave us no clues, I'm shouldn't guess what it was called.
> But if I were to make such a class, I might use slicing:
> C[:] = [57, 50, 59, 60]
>
> BTW, your naming capitalization is backwards.  Class names should begin
> with a capital,  Myclass.  Instances should begin with lowercase -
> myinstance
>
> --
>
> DaveA
>
>


-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/
-- 
http://mail.python.org/mailman/listinfo/python-list


list comprehension question

2012-10-16 Thread Kevin Anthony
I've been teaching myself list comprehension, and i've run across something
i'm not able to convert.

here's the original code for matrix multiplcation

retmatrix = Matrix(self.__row,other.__col)
for m in range(0,retmatrix.__row):
for n in range(0,retmatrix.__col):
product = 0
for p in range(1,self.__col+1):
product += (self.__matrix[m][p] * other.__matrix[p][n])
retmatrix.__matrix[m][n] = product

Here is what i have so far:
retmatrix.__matrix = [[ product = product + (self.__matrix[m][p]*
other.__matrix[p][n])
 if product else self.__matrix[m][p]* other.__matrix[p][n])
 for p in range(0,self.col)
 for n in range(0,self.col)]
 for m in range(0,self.__row)]

But i know that isn't correct, can someone nudge my in the right direction?


-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list comprehension question

2012-10-16 Thread Kevin Anthony
Is it not true that list comprehension is much faster the the for loops?

If it is not the correct way of doing this, i appoligize.
Like i said, I'm learing list comprehension.

Thanks
Kevin
On Oct 16, 2012 10:14 PM, "Dave Angel"  wrote:

> On 10/16/2012 09:54 PM, Kevin Anthony wrote:
> > I've been teaching myself list comprehension, and i've run across
> something
> > i'm not able to convert.
> >
> > here's the original code for matrix multiplcation
> >
> > retmatrix = Matrix(self.__row,other.__col)
> > for m in range(0,retmatrix.__row):
> > for n in range(0,retmatrix.__col):
> > product = 0
> > for p in range(1,self.__col+1):
> > product += (self.__matrix[m][p] * other.__matrix[p][n])
> > retmatrix.__matrix[m][n] = product
> >
> > Here is what i have so far:
> > retmatrix.__matrix = [[ product = product + (self.__matrix[m][p]*
> > other.__matrix[p][n])
> >  if product else self.__matrix[m][p]*
> other.__matrix[p][n])
> >  for p in range(0,self.col)
> >  for n in range(0,self.col)]
> >  for m in range(0,self.__row)]
> >
> > But i know that isn't correct, can someone nudge my in the right
> direction?
> >
> >
>
> The biggest thing to learn about list comprehensions is when not to use
> them.  I can't imagine how your latter version (even if correct) is
> clearer than the first.
>
>
>
> --
>
> DaveA
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there a way to programmatically turn on remote registry?

2012-10-19 Thread Kevin Holleran
Hi,

I have written a script to poll some registry values but remote registry is
turned off through GPO on the network I need to run it against.  The
account running the script is an admin on these boxes.  Is there a way for
me to turn on remote registry for the duration of the script's runtime?

Thanks for your help.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-19 Thread Kevin Holleran
Thanks!  I think this is getting me on the right track.  Now when I attempt
to start the RemoteRegistry service I am getting an exception "The RPC
server is unavailable."  However, I am done with this for today so back at
it on Monday.

Thanks for your help.

Kevin


On Fri, Oct 19, 2012 at 4:18 PM, Prasad, Ramit wrote:

> Kevin Holleran wrote:
> > Hi,
> >
> > I have written a script to poll some registry values but remote registry
> is turned off through GPO on the
> > network I need to run it against.  The account running the script is an
> admin on these boxes.  Is there a way
> > for me to turn on remote registry for the duration of the script's
> runtime?
> >
> > Thanks for your help.
> >
> > Kevin
>
> No personal experience but the web says you need to enable the remote
> registry service[1]. You can start and stop services in Python using
> win32serviceutil[2].
>
> [1] http://technet.microsoft.com/en-us/library/cc754820.aspx
> [2] http://fuzzytolerance.info/using-python-to-manage-windows-services/
>
> Ramit Prasad
>
>
> This email is confidential and subject to important disclaimers and
> conditions including on offers for the purchase or sale of
> securities, accuracy and completeness of information, viruses,
> confidentiality, legal privilege, and legal entity disclaimers,
> available at http://www.jpmorgan.com/pages/disclosures/email.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-22 Thread Kevin Holleran
Back at it this morning.  The RPC was due to needing to run it under
another account (or so I think now...). However, the RemoteRegistry service
is not just STOPPED but DISABLED.

I am trying to see if there is a call to actually set the state to MANUAL.
 Then I can star the registry, grab what I need, stop the service, then set
it back to disabled

Does anyone know if there is a way to do this?

Thanks for your help.

Kevin


On Fri, Oct 19, 2012 at 8:56 PM, Dennis Lee Bieber wrote:

> On Fri, 19 Oct 2012 17:19:56 -0400, Kevin Holleran 
> declaimed the following in gmane.comp.python.general:
>
> > Thanks!  I think this is getting me on the right track.  Now when I
> attempt
> > to start the RemoteRegistry service I am getting an exception "The RPC
> > server is unavailable."  However, I am done with this for today so back
> at
> > it on Monday.
> >
>
> Apparently you are under a VERY locked down network...
>
> RPC is another service you may have to start -- problem: you can't
> start it from a remote connection as the remote connection needs to use
> RPC . It may be faster to just telnet to each machine, logging in as
> admin, and then piping the shell commands to do the changes to the
> telnet session...
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-22 Thread Kevin Holleran
Thanks, I will look into that.  WMI is enabled, but everything WMI query I
wrote (& I am NOT a WMI expert or even close) gave me a bunch of NIC
info, but not the info I am after in the registry (driver description,
driver date, driver version for the NICs).

Thanks for your help.

Kevin


On Mon, Oct 22, 2012 at 11:05 AM, Tim Golden  wrote:

> On 22/10/2012 15:51, Kevin Holleran wrote:
> > Back at it this morning.  The RPC was due to needing to run it under
> > another account (or so I think now...). However, the RemoteRegistry
> > service is not just STOPPED but DISABLED.
> >
> > I am trying to see if there is a call to actually set the state to
> > MANUAL.  Then I can star the registry, grab what I need, stop the
> > service, then set it back to disabled
> >
> > Does anyone know if there is a way to do this?
>
> Can you connect to the remote machine via WMI? (If the remote registry
> service is stopped, WMI might be also). If so, you can access the
> registry remotely via WMI:
>
>
>   http://timgolden.me.uk/python/wmi/cookbook.html#list-registry-keys
>
> Ultimately, you need *something* on the remote machine to be running
> which will accept incoming requests. If nothing is (because the machine
> & network are secured) then you're not going to be able to do what you
> want.
>
> TJG
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-22 Thread Kevin Holleran
Tim,

I am looking here:

SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF9F6FB0-C999-4D19-BED0-144F77E2A9D6}

Enumerating the keys for a BusType == 5, then grabbing the values of
DriverDesc, DriverDate, & DriverVersion.

So I am doing this:

 try:
hKey = _winreg.OpenKey (keyPath,
r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF9F6FB0-C999-4D19-BED0-144F77E2A9D6}",
0, _winreg.KEY_READ)
i=0
while True:
try:
subkey = _winreg.EnumKey(hKey, i)
i += 1
if (subkey.QueryValueEx(hKey,"BusType") == "5"):
outputline = host + "," +
subkey.QueryValueEx(hKey,"DriverDesc") + "," +
subkey.QueryValueEx(hKey,"DriverDate") + "," +
subkey.QueryValueEx(hKey,"DriverVersion") + "\n"
print outputline
outputFile.write(outputLine)
except WindowsError, e:
# WindowsError: [Errno 259] No more data is available

pass
except:
print "Unable to query registry key for NIC adapters"

Thanks.  I am reviewing the WMI Registry piece you sent over right now.  I
am certainly open to anyway I can get the info.  I have some odd behaviors
across some servers during vulnerability scanning & have a suspicion that
some driver discrepancies on the NIC are to blame.

Kevin


On Mon, Oct 22, 2012 at 3:29 PM, Tim Golden  wrote:

> On 22/10/2012 16:38, Kevin Holleran wrote:
>
>> Thanks, I will look into that.  WMI is enabled, but everything WMI query I
>> wrote (& I am NOT a WMI expert or even close) gave me a bunch of NIC
>> info, but not the info I am after in the registry (driver description,
>> driver date, driver version for the NICs).
>>
>
> I assume you've found things like the Win32_NetworkAdapter which doesn't
> include driver details. If you cared to come across with the registry keys
> / values you needed I'm sure I could rustle up a sample query to get you on
> the right path.
>
> TJG
>
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-23 Thread Kevin Holleran
Tim,

I am re-implementing in my script now.  I'll let you know how it goes... I
just realized that the key that I sent over was completely wrong I am
not sure how I even got it as it is the combination of two different keys
from two different scripts... must have been working too long and
everything blending together... :)

Thanks for your help!

Kevin


On Tue, Oct 23, 2012 at 4:07 AM, Tim Golden  wrote:

> On 22/10/2012 21:01, Kevin Holleran wrote:
> > Tim,
> >
> > I am looking here:
> >
> >
> SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF9F6FB0-C999-4D19-BED0-144F77E2A9D6}
> >
> > Enumerating the keys for a BusType == 5, then grabbing the values of
> > DriverDesc, DriverDate, & DriverVersion.
> >
> > So I am doing this:
>
> [... snip querying uninstallers ...]
>
> I don't have that particular uninstaller key but the code below, using
> the wmi module to hide the plumbing, queries all the installers and
> should give you enough of an idea, hopefully. For brevilty, I've only
> bothered with extracting string values; it would be easy to extract
> other datatypes.
>
> To perform the same query on another computer, just pass the other
> computer name (or IP address) as the first parameter to the wmi.WMI call
> (or use the named param "computer").
>
> 
> import _winreg as winreg
> import wmi
>
> HKLM = winreg.HKEY_LOCAL_MACHINE
> UNINSTALLERS = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
>
> registry = wmi.WMI(namespace="default").StdRegProv
> _, names = registry.EnumKey(HKLM, UNINSTALLERS)
> for name in names:
> print name
> uninstaller = UNINSTALLERS + "\\" + name
> _, value_names, value_types = registry.EnumValues(HKLM, uninstaller)
> for value_name, value_type in zip(value_names, value_types):
> if value_type == winreg.REG_SZ:
> _, value = registry.GetStringValue(
>   HKLM, uninstaller, value_name
> )
> else:
> value = "(Non-string value)"
> print u"  ", value_name, u"=>", value
>
> 
>
>
> TJG
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-24 Thread Kevin Holleran
On Tue, Oct 23, 2012 at 11:44 AM, Kevin Holleran  wrote:

> On Tue, Oct 23, 2012 at 11:39 AM, Tim Golden  wrote:
>
>> On 23/10/2012 16:17, Kevin Holleran wrote:
>> > I am still having a small implementation problem
>> >
>> > [code]
>> > HKLM = winreg.HKEY_LOCAL_MACHINE
>> > NICs =
>> >
>> "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"
>> >
>> >  registry = wmi.WMI(host, namespace="default").StdRegProv
>> >   _, names = registry.EnumKey(HKLM,NICs) # <-- Error
>> > [/code]
>> >
>> > [error]
>> >   File "wmi.pyc", line 241, in handle_com_error
>> > wmi.x_wmi: > > occurred.', (0,
>> >  u'SWbemProperty', u'Type mismatch ', None, 0, -2147217403), None)>
>> > [\error]
>>
>>
>> I can see nothing wrong with that. On my system the following code works
>> fine:
>>
>> 
>> import _winreg as winreg
>> import wmi
>>
>> host = "SVR18"
>>
>> HKLM = winreg.HKEY_LOCAL_MACHINE
>> NICs =
>>
>> "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"
>>
>> registry = wmi.WMI(host, namespace="default").StdRegProv
>> _, names = registry.EnumKey(HKLM,NICs) # <-- Error
>>
>> print names
>>
>> 
>>
>> Am I understanding you correctly? Can you send me an interpreter
>> screendump showing the failure with the traceback (just in case anything
>> useful occurs to me when I see it)?
>>
>>
>> TJG
>>
>
> I will but I have to run to a meeting.  I will send over.  Another note,
> probably should have mentioned earlier, I am using py2exe & running the
> executable from the the machine that has access to these systems.
>
> Kevin
>

Here is the full traceback:

[output]
Scan_NIC_Driver_Info_1.2.py -i testing_MSK_Server.csv -o
MSK_Test_output.csv -u unreachable.csv
Parsing input file...

Connecting to IP...

Traceback (most recent call last):
  File
"D:\Development\Scripts\Python\Scan_NIC_Driver_Info\Scan_NIC_Driver_Info_
1.2.py", line 70, in 
_, names = registry.EnumKey(HKLM,NICs)
  File "C:\Python27\lib\site-packages\wmi.py", line 431, in __call__
handle_com_error ()
  File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
raise klass (com_error=err)
wmi.x_wmi: 

[/output]

Basically, it parses a list of hosts from a CSV, outputs a series of lines:
host, driverDesc, diverDate, driverVersion.  Basically it pings the host
first to make sure its up.

Here are the relevant parts to the script:

[code]
 registry = wmi.WMI(host, namespace="default").StdRegProv
_, names = registry.EnumKey(HKLM,NICs)
print("Connected successfully.")
try:
for name in names:
print name
NIC = NICs + "\\" + name
_, value_names, value_types = registry.EnumValues(HKLM, NIC)
for value_name, value_type in zip(value_names, value_types):
if value_type == winreg.REG_SZ:
if value_name == "BusType":
_, busType = registry.GetStringValue(HKLM,
NICs, value_name)
elif value_name == "DriverDesc":
_, driverDesc = registry.GetStringValue(HKLM,
NICs, value_name)
elif value_name == "DriverDate":
_, driverDate = registry.GetStringValue(HKLM,
NICs, value_name)
elif value_name == "DriverVersion":
_, driverVersion =
registry.GetStringValue(HKLM, NICs, value_name)
if busType == 5:
outputline = host + "," + driverDesc + "," +
driverDate + "," + driverVersion + "\n"
print outputline
outputFile.write(outputLine)
except:
print "Unable to query registry key for NIC adapters"
[/code]

Thanks again.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-24 Thread Kevin Holleran
On Wed, Oct 24, 2012 at 7:51 AM, Tim Golden  wrote:

> On 24/10/2012 12:40, Kevin Holleran wrote:> Here is the full traceback:
> >
> Could you confirm what version of Windows is running on the remote
> machine? Also, could you show the output of the following, please:
>
> 
> import wmi
>
> host = "" # pick one
>
> print wmi.WMI(host, namespace="default").StdRegProv
>
> 
>
>
> TJG
>

The machine I am testing from is Windows7, the machine I will run this from
is running an exe generated from py2exe and is running Windows 2008 server.

The machines I am targeting are all Windows 2003 Server machines, though I
am hoping to also expand and use this script on a number of Windows XP
devices (which shouldn't be a problem...)

Here is the output as you requested.  Again thanks for your time & help.  I
hate monopolizing one person's time so much


>python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wmi
>>> host=""#removed from ouput
>>> print wmi.WMI(host,namespace="default").StdRegProv
[Locale(1033), dynamic: ToInstance, provider("RegProv")]
class StdRegProv
{
[implemented, static] uint32 CreateKey([IN] uint32 hDefKey =
2147483650,
 [IN] string sSubKeyName);
[implemented, static] uint32 DeleteKey([IN] uint32 hDefKey =
2147483650,
 [IN] string sSubKeyName);
[implemented, static] uint32 EnumKey([IN] uint32 hDefKey =
2147483650, [
IN] string sSubKeyName, [out] string sNames[]);
[implemented, static] uint32 EnumValues([IN] uint32 hDefKey =
2147483650
, [IN] string sSubKeyName, [out] string sNames[], [out] sint32 Types[]);
[implemented, static] uint32 DeleteValue([IN] uint32 hDefKey =
214748365
0, [IN] string sSubKeyName, [in] string sValueName);
[implemented, static] uint32 SetDWORDValue([IN] uint32 hDefKey =
2147483
650, [IN] string sSubKeyName, [in] string sValueName, [in] uint32 uValue =
3);
[implemented, static] uint32 GetDWORDValue([IN] uint32 hDefKey =
2147483
650, [IN] string sSubKeyName, [in] string sValueName, [out] uint32 uValue);
[implemented, static] uint32 SetStringValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [in] string sValue =
"hel
lo");
[implemented, static] uint32 GetStringValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [out] string sValue);
[implemented, static] uint32 SetMultiStringValue([IN] uint32
hDefKey = 2
147483650, [IN] string sSubKeyName, [in] string sValueName, [in] string
sValue[]
 = {"hello", "there"});
[implemented, static] uint32 GetMultiStringValue([IN] uint32
hDefKey = 2
147483650, [IN] string sSubKeyName, [in] string sValueName, [out] string
sValue[
]);
[implemented, static] uint32 SetExpandedStringValue([IN] uint32
hDefKey
= 2147483650, [IN] string sSubKeyName, [in] string sValueName, [in] string
sValu
e = "%path%");
[implemented, static] uint32 GetExpandedStringValue([IN] uint32
hDefKey
= 2147483650, [IN] string sSubKeyName, [in] string sValueName, [out] string
sVal
ue);
[implemented, static] uint32 SetBinaryValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [in] uint8 uValue[]
= {1,
 2});
[implemented, static] uint32 GetBinaryValue([IN] uint32 hDefKey =
214748
3650, [IN] string sSubKeyName, [in] string sValueName, [out] uint8
uValue[]);
[implemented, static] uint32 CheckAccess([IN] uint32 hDefKey =
214748365
0, [IN] string sSubKeyName, [in] uint32 uRequired = 3, [out] boolean
bGranted);
};

>>> registry=wmi.WMI(host,namespace="default").StdRegProv
>>> import _winreg as winreg
>>> HKLM = winreg.HKEY_LOCAL_MACHINE
>>> NICs =
"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-
08002bE10318}"
>>> _, names=registry.EnumKey(HKLM,NICs)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\site-packages\wmi.py", line 431, in __call__
handle_com_error ()
  File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
raise klass (com_error=err)
wmi.x_wmi: 
>>> print registry.EnumKey(HKLM,NICs)


Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to programmatically turn on remote registry?

2012-10-24 Thread Kevin Holleran
On Wed, Oct 24, 2012 at 9:11 AM, Tim Golden  wrote:

> On 24/10/2012 13:36, Kevin Holleran wrote:
> > Here is the output as you requested.  Again thanks for your time & help.
> >  I hate monopolizing one person's time so much
>
> Heh. Everyone else is welcome to chip in :)
>
> Ok, try specifying the parameter names. (I remember someone having
> problems before caused by mismatched param order):
>
>
>
OK, tried that as well as specifying the parameters directly instead of
through variables, with the same result  I even looked back through my
old scripts but I have not used the WMI module in this way... only to do
WMI queries...

Strange

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Executing .exe on a remote Windows machine

2012-11-08 Thread Kevin Holleran
Good morning,

I wrote a python script to connect out to a bunch of my remote machines
that are running some software.  It modifies a bunch of the config files
for me.  After making the changes, I need to restart the software.  The way
to do this is to call an .exe passing in a argument 'restart'  Simply
restarting services is NOT acceptable & rebooting the machine isn't either.

I was trying to find a way to simply call the .exe on the remote machine
with subprocess but how can I get it to execute on the remote machine?
 These machines do not have SSH.

Is there a way to do this or am I stuck coordinating a time when the
machines can be rebooted? (because this would be faster than asking anyone
on site to execute the command)

Thanks for your help.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing .exe on a remote Windows machine

2012-11-08 Thread Kevin Holleran
My goodness psexec.

thanks can't believe that didn't come to me...



--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP

My Paleo & Fitness Blog <http://kevinspaleofitness.blogspot.com/>

"Do today what others won't, do tomorrow what others can't" - SEALFit

"We are what we repeatedly do. Excellence, then, is not an act, but a
habit." - Aristotle



On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden  wrote:

> On 08/11/2012 14:25, Kevin Holleran wrote:
> > Good morning,
> >
> > I wrote a python script to connect out to a bunch of my remote machines
> > that are running some software.  It modifies a bunch of the config files
> > for me.  After making the changes, I need to restart the software.  The
> > way to do this is to call an .exe passing in a argument 'restart'
> >  Simply restarting services is NOT acceptable & rebooting the machine
> > isn't either.
> >
> > I was trying to find a way to simply call the .exe on the remote machine
> > with subprocess but how can I get it to execute on the remote machine?
> >  These machines do not have SSH.
>
> WMI can usually help with this (although there are limitations on what
> you can execute via WMI). Also people recommend sysinternals' psexec.
> (I've never tried it myself).
>
> TJG
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing .exe on a remote Windows machine

2012-11-08 Thread Kevin Holleran
On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran  wrote:

> My goodness psexec.
>
> thanks can't believe that didn't come to me...
>
>
>
>
> On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden  wrote:
>
>> On 08/11/2012 14:25, Kevin Holleran wrote:
>> > Good morning,
>> >
>> > I wrote a python script to connect out to a bunch of my remote machines
>> > that are running some software.  It modifies a bunch of the config files
>> > for me.  After making the changes, I need to restart the software.  The
>> > way to do this is to call an .exe passing in a argument 'restart'
>> >  Simply restarting services is NOT acceptable & rebooting the machine
>> > isn't either.
>> >
>> > I was trying to find a way to simply call the .exe on the remote machine
>> > with subprocess but how can I get it to execute on the remote machine?
>> >  These machines do not have SSH.
>>
>> WMI can usually help with this (although there are limitations on what
>> you can execute via WMI). Also people recommend sysinternals' psexec.
>> (I've never tried it myself).
>>
>> TJG
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>

OK, not quite resolved yet

My code

[code]
try:
print("Attempting to restart Splunk...")
subprocess.call(["psexec", "" + host, "'c:\\Program
Files\\Splunk\\bin\\splunk.exe'", "restart"])
[/code]

& am getting:

[output]
Attempting to restart Splunk...

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com


PsExec could not start 'c:\Program Files\Splunk\bin\splunk.exe' restart on
[IP_ADDRESS]:
The filename, directory name, or volume label syntax is incorrect.
[/output]

I am simply trying to restart the splunk forwarder instance

Any thoughts??

Thanks.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing .exe on a remote Windows machine

2012-11-08 Thread Kevin Holleran
On Thu, Nov 8, 2012 at 11:32 AM, Chris Rebert  wrote:

> On Thursday, November 8, 2012, Kevin Holleran wrote:
>
>> On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran  wrote:
>>
>>> My goodness psexec.
>>>
>>> thanks can't believe that didn't come to me...
>>>
>>>
>>>
>>>
>>> On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden  wrote:
>>>
>>>> On 08/11/2012 14:25, Kevin Holleran wrote:
>>>> > Good morning,
>>>> >
>>>> > I wrote a python script to connect out to a bunch of my remote
>>>> machines
>>>> > that are running some software.  It modifies a bunch of the config
>>>> files
>>>> > for me.  After making the changes, I need to restart the software.
>>>>  The
>>>> > way to do this is to call an .exe passing in a argument 'restart'
>>>> >  Simply restarting services is NOT acceptable & rebooting the machine
>>>> > isn't either.
>>>> >
>>>> > I was trying to find a way to simply call the .exe on the remote
>>>> machine
>>>> > with subprocess but how can I get it to execute on the remote machine?
>>>> >  These machines do not have SSH.
>>>>
>>>> WMI can usually help with this (although there are limitations on what
>>>> you can execute via WMI). Also people recommend sysinternals' psexec.
>>>> (I've never tried it myself).
>>>>
>>>> TJG
>>>> --
>>>> http://mail.python.org/mailman/listinfo/python-list
>>>>
>>>
>>>
>>
>> OK, not quite resolved yet
>>
>> My code
>>
>> [code]
>> try:
>> print("Attempting to restart Splunk...")
>> subprocess.call(["psexec", "" + host, "'c:\\Program
>> Files\\Splunk\\bin\\splunk.exe'", "restart"])
>> [/code]
>>
>> & am getting:
>>
>> [output]
>> Attempting to restart Splunk...
>>
>> PsExec v1.98 - Execute processes remotely
>> Copyright (C) 2001-2010 Mark Russinovich
>> Sysinternals - www.sysinternals.com
>>
>>
>> PsExec could not start 'c:\Program Files\Splunk\bin\splunk.exe' restart
>> on [IP_ADDRESS]:
>> The filename, directory name, or volume label syntax is incorrect.
>>  [/output]
>>
>> I am simply trying to restart the splunk forwarder instance
>>
>> Any thoughts??
>>
>
> Remove the apostrophes surrounding the path to Splunk's executable. The
> subprocess module already takes care of the quoting for you, so the
> apostrophes are unnecessary and are being interpreted literally.
>
>
> --
> Cheers,
> Chris
> --
> http://rebertia.com
>

Thanks Tim & Chris... you guys are my heroes for today :)
-- 
http://mail.python.org/mailman/listinfo/python-list


re.search when used within an if/else fails

2012-11-19 Thread Kevin T
python version 2.4.3, yes i know that it is old.  getting the sysadmin to 
update the OS requires a first born.

with the following code..
for signal in register['signals'] :

351   sigName = signal['functionName']
352   if re.search( "rsrvd", sigName ) == None :
353  print sigName
354  newVal = "%s%s" % ( '1'*signal['bits'] , newVal ) 
#prepend 0's
355   if re.search( "rsrvd", sigName ) != None :
356  print sigName
357  newVal = "%s%s" % ( '0'*signal['bits'], newVal )

regardless of how i code line 352, i can not EVER use an else clause with it.  
if i use an else clause, the else will NEVER get executed...

has any one experienced anything like this behavior?  any suggestions?  the 
above code works but... why should i have to code it like this?

kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.search when used within an if/else fails

2012-11-20 Thread Kevin T
On Monday, November 19, 2012 7:29:20 PM UTC-6, Steven D'Aprano wrote:
> On Tue, 20 Nov 2012 01:24:54 +, Steven D'Aprano wrote:
> 
> 
> 
> - use "if something is None", not == None.
> 
> 
> Steven

i will not include line #'s in the future, point taken
i will change ==/!= to is/is not as most people pointed out.

there is no else because it doesn't work.

i used eclipse in debug mode and a command line execution of the code, both 
behave the same way

#if re.search( "rsrvd", sigName ) :   #version a
#if re.search( "rsrvd", sigName ) == None :   #version b
if re.search( "rsrvd", sigName ) is None :   #version bb
   print sigName 
   newVal = "%s%s" % ('1'*signal['bits'] , newVal ) 
#else: #version c
if re.search( "rsrvd", sigName ) != None :   #version d
   print sigName 
   newVal = "%s%s" % ( '0'*signal['bits'],> newVal ) 

i can use either version a/b the else clause (version c) will not execute.
fortunately,  with version bb, the else clause will execute!!  

thanks for the input all..

kevin

Now if i change
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.search when used within an if/else fails

2012-11-21 Thread Kevin T
On Nov 20, 1:37 pm, Ian Kelly  wrote:
> On Tue, Nov 20, 2012 at 12:09 PM, Kevin T  wrote:
> > #if re.search( "rsrvd", sigName ) :   #version a
> > #if re.search( "rsrvd", sigName ) == None :   #version b
> > if re.search( "rsrvd", sigName ) is None :   #version bb
> >    print sigName
> >    newVal = "%s%s" % ('1'*signal['bits'] , newVal )
> > #else:                                 #version c
> > if re.search( "rsrvd", sigName ) != None :   #version d
> >    print sigName
> >    newVal = "%s%s" % ( '0'*signal['bits'],> newVal )
>
> > i can use either version a/b the else clause (version c) will not execute.
> > fortunately,  with version bb, the else clause will execute!!
>
> There must be some other difference in your testing.  I don't have
> Python 2.4 available, but I tried your version a in both Python 2.3
> and 2.5 using made-up values for sigName, and the else clause is
> executed in both.

I went back and tried version a again, blam it is/does work now ?!?!?
I am not sure what changed but version a was the original code that
wouldn't work.  All the examples i had read, showed version a as a
working version.  I spent significant time trying version a with
parens, spacing changes, different regex values to no avail.  hence
the creation of all the other versions.

thanks for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.search when used within an if/else fails

2012-11-28 Thread Kevin T
I agree. Being relatively new to python, i was not sure of quirks so i posted 
the original code.  

I did find the real issue, as I found another loop that was not being executed 
properly.

It turns out that if the indent started with spaces and ended with tabs, 
neither eclipse or command line execution would complain.  where as if the 
indent begins with tabs and has spaces in the middle the tools will complain of 
indentation issues.

i have found that the vi plugin for python is the culprit here.  when the 
plugin does block indentation, the result is indents that begin with spaces.  
if i disable the vi plugin and use the regular eclipse editor these issues go 
away.

with other languages i always expand tabs to spaces.  the vi plugin does do 
this properly.  if i change all indents to be spaces only will python behave?  
i inherited a good deal of the code that i am using, which is tab based.

thanks kevin


On Wednesday, November 21, 2012 11:00:50 PM UTC-6, Chris Angelico wrote:
> On Thu, Nov 22, 2012 at 3:41 AM, Kevin T  wrote:
> 
> > I went back and tried version a again, blam it is/does work now ?!?!?
> 

> 
> 
> This is why the Short, Self-Contained, Correct Example is so
> 
> important. See http://sscce.org/ for some info on that. I often find
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Keeping a Tkinter GUI alive during a long running process

2012-12-20 Thread Kevin Walzer
I maintain a Tkinter application that's a front-end to to a package 
manger, and I have never been able to find a way to keep the app from 
locking up at some point during the piping in of the package manager's 
build output into a text widget. At some point the buffer is overwhelmed 
and the app simply can't respond anymore, or writes data to the text 
widget after locking up for a period.


I've long used the typical Tkinter design pattern of opening a pipe to 
the external command, and letting it do its thing. However, after a 
time, this locks up the app. If I try to throttle the buffer with some 
combination of "update" or "after" or "update_idletasks," that keeps the 
data flowing, but it comes in too slowly and keeps flowing in long after 
the external process has terminated.


Below is a sample function that illustrates how I approach this issue. 
Can someone suggest a better approach?


 #install a fink package
def installPackage(self):

self.package = self.infotable.getcurselection()
if not self.package:
showwarning(title='Error', message='Error', detail='Please 
select a package name.', parent=self)

return
else:
self.clearData()
self.packagename = self.package[0][1]
self.status.set('Installing %s' % self.packagename)
self.setIcon(self.phynchronicity_install)
self.playSound('connect')
self.showProgress()
self.file = Popen('echo %s | sudo -S %s -y install %s' % 
(self.passtext, self.finkpath.get(), self.packagename), shell=True, 
bufsize=0, stdout=PIPE).stdout

for line in self.file:
self.inserturltext(line)
self.after(5000, self.update_idletasks)

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Second try: non-blocking subprocess pipe and Tkinter in 2.7

2012-12-21 Thread Kevin Walzer
Yesterday I posted a question about keeping a Tkinter GUI during a 
long-running process, i.e. reading data from a pipe via the subprocess 
module. I think that question did not quite get at the heart of the 
issue because it assumed that Python, like Tcl which underlies Tkinter, 
supports non-blocking, asynchronous reading out of the box. Apparently 
it does not.


So, my question is hereby revised as such: how can I implement a 
non-blocking read of a subprocess pipe that can write data to the 
Tkinter text widget in an manner that does not cause the GUI to lock up?


--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Command Line Progress Bar

2012-12-25 Thread Kevin Anthony
Hello,
I'm writing a file processing script(Linux), and i would like to have a
progress bar.  But i would also like to be able to print messages.  Is
there a simple way of doing this without implementing something like
ncurses?

-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHON 3.3 + GUI + COMPILE

2012-12-27 Thread Kevin Walzer

On 12/27/12 9:08 PM, Dimitrios Xenakis wrote:

Morning,
I have been looking for a library solution of both GUI and Compiler but for 
Python 3.3 and ofcourse i was hoping for a combination that would be most 
compatible between them. After searching i may have concluded to cx_Freeze 
(because it was the only one that noticed that currently supports version 
Python 3.3), but i do not know what GUI library should i combine it with. Does 
cx_Freeze alone put any kind of restriction to my choice of GUI? I would also 
be interested in using my programs for commercial purposes, so would this put 
again some other kind of limitations to my GUI choice? I have read many good 
stuff about PySide, but still i do not know wether this is the one that i 
should choose. Is PySide same as PyQT and PyQT4 and QT or which is the exact 
relationship between those? Disadvantages - advantages, capabilities, benefits, 
costs, etc. (What is the lowest possible cost of buying such a commercial 
license for my programming?. Are there different versions and should i be carefu

l
l to choose the best for me? Where could i get this from? PySide is total free 
for my commercial needs?) I need to be legit so i guess i should learn how to 
handle with the licencing thing. Please somebody clear things for me.


Thanks 4 your time i really appreciate that.



cx_Freeze has good support for Tkinter, PyQt, and (as far as I know) 
wxPython.


License: Qt is LGPL. PyQt is GPL or commercial. PySide is, I believe, 
the same as Qt itself. I'm not sure how mature or well-supported PySide 
is, in general.


wxPython is LGPL with a commercial exception clause, which allows you to 
use it in closed-source apps.


Tkinter, as part of the stlib, has a very liberal license (BSD-style), 
as does Tcl/Tk, which allows for free use in commercial apps.


Hope this helps,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


wiki.python.org

2013-01-09 Thread Reed, Kevin
Hello,

I have been unable to access wiki.python.org for two days.  Is there a problem 
with the server, or is it me?

Thank you much,

Kevin C. Reed
New Python User
-- 
http://mail.python.org/mailman/listinfo/python-list


Previous Question Answered - Thank You All For Your Replies

2013-01-09 Thread Reed, Kevin
Hello,

My question concerning wiki.python.org unavailability has been answered.  Thank 
you all for your assistance!  You guys are awesome!

For those of you who don't know, here's the info.

http://mail.python.org/pipermail/python-list/2013-January/638182.html

Thanks again,

Kevin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Importing class from another file

2013-01-22 Thread Kevin Holleran
Thanks, you got me straightened out.


--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
SANS GCFA, SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP

"Do today what others won't, do tomorrow what others can't" - SEALFit

"We are what we repeatedly do. Excellence, then, is not an act, but a
habit." - Aristotle


On Tue, Jan 22, 2013 at 2:47 PM, John Gordon  wrote:

> In  Kevin Holleran <
> kdaw...@gmail.com> writes:
>
> > I have a class called My_Class in a subdir called Sub_Dir.
>
> > in My_Class.py is the following
>
> > class My_Class_Connector:
> > def __init__(self,un,pw,qs_srv="domain.com"):
> > self.username = un
> > self.password = pw
>
> > Then I am trying to call from a script in the parent dir like this:
>
> > from Sub_Dir.My_Class import *
>
> > q_api = My_Class.My_Class_Connector(string1,string2)
>
> Even if your import had worked, this would be wrong.  You're importing
> everything from Sub_Dir.My_Class, so My_Class_Connector is in the current
> namespace.  You don't need to add "My_Class." on the front (and in fact
> it's an error to do so.)
>
> > Traceback (most recent call last):
> >   File "testing.py", line 1, in 
> > from Sub_Dir.My_Class import *
> > ImportError: No module named Sub_Dir.My_Class
>
> Is there a file named __init__.py in Sub_Dir?  A directory must contain
> that file in order to be considered a "module".  (If you don't know what
> to put in the file, just leave it empty.)
>
> --
> John Gordon   A is for Amy, who fell down the stairs
> gor...@panix.com  B is for Basil, assaulted by bears
> -- Edward Gorey, "The Gashlycrumb Tinies"
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
Is there a way to parse out a wireshark pcap file and extract key value
pairs from the data?  I am illustrated a sniff of some traffic and why it
needs utilize HTTPS instead of HTTP but I was hoping to run the pcap
through a python script and just output some interesting key value
pairs

Thanks for your help.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2.  I
tried to get it from Macports and download/install it myself.  Both seem to
get me to here:

ImportError: No module named dnet

I tried to download libdnet but no matter what I do this is what I get.
 Granted I am doing;

from scapy.all import *


But I have no idea what I need.  I am not trying to craft packets but
filter packets based on tcp.dstport 80 & frame matches signin.aspx.  Then
my goal is to parse the data looking for post vars txtUserId & txtPwd and
extract them, dumping them to the screen as userid_value => password.


Thanks for your help.

--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
SANS GCFA, SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP

"Do today what others won't, do tomorrow what others can't" - SEALFit

"We are what we repeatedly do. Excellence, then, is not an act, but a
habit." - Aristotle


On Tue, Jan 22, 2013 at 10:03 PM, Dave Angel  wrote:

> On 01/22/2013 08:32 PM, Kevin Holleran wrote:
>
>> Is there a way to parse out a wireshark pcap file and extract key value
>> pairs from the data?  I am illustrated a sniff of some traffic and why it
>> needs utilize HTTPS instead of HTTP but I was hoping to run the pcap
>> through a python script and just output some interesting key value
>> pairs
>>
>>
> Sure.  scapy can create and/or parse pcap files.
>
> http://pypi.python.org/pypi/**Scapy <http://pypi.python.org/pypi/Scapy>
>
>
> --
> DaveA
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
I also found this:

http://code.google.com/p/py-greppcap/

Which I can leverage to do what I want but I also get that dnet error!


--
Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
SANS GCFA, SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP

"Do today what others won't, do tomorrow what others can't" - SEALFit

"We are what we repeatedly do. Excellence, then, is not an act, but a
habit." - Aristotle


On Tue, Jan 22, 2013 at 10:15 PM, Kevin Holleran  wrote:

> Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2.  I
> tried to get it from Macports and download/install it myself.  Both seem to
> get me to here:
>
> ImportError: No module named dnet
>
> I tried to download libdnet but no matter what I do this is what I get.
>  Granted I am doing;
>
> from scapy.all import *
>
>
> But I have no idea what I need.  I am not trying to craft packets but
> filter packets based on tcp.dstport 80 & frame matches signin.aspx.  Then
> my goal is to parse the data looking for post vars txtUserId & txtPwd and
> extract them, dumping them to the screen as userid_value => password.
>
>
> Thanks for your help.
>
> --
> Kevin Holleran
> Master of Science, Computer Information Systems
> Grand Valley State University
> Master of Business Administration
> Western Michigan University
> SANS GCFA, SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP
>
> "Do today what others won't, do tomorrow what others can't" - SEALFit
>
> "We are what we repeatedly do. Excellence, then, is not an act, but a
> habit." - Aristotle
>
>
> On Tue, Jan 22, 2013 at 10:03 PM, Dave Angel  wrote:
>
>> On 01/22/2013 08:32 PM, Kevin Holleran wrote:
>>
>>> Is there a way to parse out a wireshark pcap file and extract key value
>>> pairs from the data?  I am illustrated a sniff of some traffic and why it
>>> needs utilize HTTPS instead of HTTP but I was hoping to run the pcap
>>> through a python script and just output some interesting key value
>>> pairs
>>>
>>>
>> Sure.  scapy can create and/or parse pcap files.
>>
>> http://pypi.python.org/pypi/**Scapy <http://pypi.python.org/pypi/Scapy>
>>
>>
>> --
>> DaveA
>> --
>> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
On Tue, Jan 22, 2013 at 10:29 PM, Dave Angel  wrote:

> On 01/22/2013 10:15 PM, Kevin Holleran wrote:
>
>> Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2.  I
>> tried to get it from Macports and download/install it myself.  Both seem
>> to
>> get me to here:
>>
>> ImportError: No module named dnet
>>
>> I tried to download libdnet but no matter what I do this is what I get.
>>   Granted I am doing;
>>
>> from scapy.all import *
>>
>>
>> But I have no idea what I need.  I am not trying to craft packets but
>> filter packets based on tcp.dstport 80 & frame matches signin.aspx.  Then
>> my goal is to parse the data looking for post vars txtUserId & txtPwd and
>> extract them, dumping them to the screen as userid_value => password.
>>
>>
> I've never worked on Mac OSx   And the only times I had and used scapy
> were on a work machine that's long gone.  I still run Linux, but versions
> of everything have changed since then.
>
> I don't know if there's anyone here that's more current with scapy and/or
> with Mac, but in case there is, you could be lots clearer about what you're
> doing and how it fails.
>
> Version of OS.  You said that well.
> Version of Python,.
> Exact location you got scapy from, what version it was
> How you installed it (I don't know Macports, clearly)
> What the full traceback was when it died.
>
>
>
>
> --
> DaveA
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>

Noted, I will try to be more verbose.

Mac OS 10.8.2
Python v.2.7
I downloaded from the sourceforge site, then tried to install with MacPorts
when some dependencies were failing.  I then downloaded & installed
pcapy-0.10.6 when that dependency still failed.  That solved that but I
received the dnet error:

from scapy.all import conf
  File "/Library/Python/2.7/site-packages/scapy/all.py", line 16, in

from arch import *
  File "/Library/Python/2.7/site-packages/scapy/arch/__init__.py", line 75,
in 
from bsd import *
  File "/Library/Python/2.7/site-packages/scapy/arch/bsd.py", line 12, in

from unix import *
  File "/Library/Python/2.7/site-packages/scapy/arch/unix.py", line 20, in

from pcapdnet import *
  File "/Library/Python/2.7/site-packages/scapy/arch/pcapdnet.py", line
160, in 
import dnet
ImportError: No module named dnet

So I downloaded and compiled libdnet-1.11 with a:
 $ sudo ./configure && make

I see it compile fine & the libraries have been installed to:
/usr/local/sbin/dnet

However, python can't find it... I am not clear on how to point Python
there...

Thanks again.

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse a Wireshark pcap file

2013-01-23 Thread Kevin Holleran
On Wed, Jan 23, 2013 at 7:25 AM, John Evans wrote:

> The import "from scapy.all import *" does work for me with macports and
> 10.6.8  When I installed the scapy port, I did see that macports installed
> the py27-libdnet package as well.
>
>
> 
>
>
> On Wed, Jan 23, 2013 at 1:24 AM, Dennis Lee Bieber 
> wrote:
>
>> On Tue, 22 Jan 2013 22:43:24 -0500, Kevin Holleran 
>> declaimed the following in gmane.comp.python.general:
>>
>> >
>> > Mac OS 10.8.2
>> > Python v.2.7
>> > I downloaded from the sourceforge site, then tried to install with
>> MacPorts
>> > when some dependencies were failing.  I then downloaded & installed
>> > pcapy-0.10.6 when that dependency still failed.  That solved that but I
>> > received the dnet error:
>> >
>> > from scapy.all import conf
>> >   File "/Library/Python/2.7/site-packages/scapy/all.py", line 16, in
>> > 
>> > from arch import *
>> >   File "/Library/Python/2.7/site-packages/scapy/arch/__init__.py", line
>> 75,
>> > in 
>> > from bsd import *
>> >   File "/Library/Python/2.7/site-packages/scapy/arch/bsd.py", line 12,
>> in
>> > 
>> > from unix import *
>> >   File "/Library/Python/2.7/site-packages/scapy/arch/unix.py", line 20,
>> in
>> > 
>> > from pcapdnet import *
>> >   File "/Library/Python/2.7/site-packages/scapy/arch/pcapdnet.py", line
>> > 160, in 
>> > import dnet
>> > ImportError: No module named dnet
>> >
>> > So I downloaded and compiled libdnet-1.11 with a:
>> >  $ sudo ./configure && make
>> >
>> > I see it compile fine & the libraries have been installed to:
>> > /usr/local/sbin/dnet
>> >
>> > However, python can't find it... I am not clear on how to point Python
>> > there...
>> >
>> "libdnet" is likely a shared object binary... What I /think/ you
>> are
>> missing is the Python library that interfaces with that binary...
>>
>> Could http://pypi.python.org/pypi/dnet answer the question?
>> --
>> Wulfraed Dennis Lee Bieber AF6VN
>> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
>
> --
> John Evans
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

I downloaded scapy manually since for some reason, after using macports, it
wouldn't find the package at all.

I am also trying to install libdnet manually as mentioned above, so after
./configure && make I go into the python directory & do a  python setup.py
install, which generates a bunch of warnings & the following two errors:

/dnet.c:2729:4: error: assignment to cast is illegal, lvalue casts are not
supported
  ((PyObject*)__pyx_v_next) = Py_None; Py_INCREF(((PyObject*)__pyx_v_next));
  ~^~~~ ~
./dnet.c:2741:6: error: assignment to cast is illegal, lvalue casts are not
supported
((PyObject *)__pyx_v_next) = __pyx_3;
~^ ~


Thanks again for any help.  Need to get all this working for this
mini-project and also because I am starting a SANS class that leverages
scapy quite a bit...

Kevin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Buffering in Wing and IDLE 3

2012-02-01 Thread Kevin Walzer

On 2/1/12 3:01 PM, Terry Reedy wrote:

On 2/1/2012 10:17 AM, Franck Ditter wrote:


I would prefer to use IDLE but as we are in France, the Python team
does not seem to be aware that the ~ and others are not available
on MacOS-X here (probably the same in Europe)...


We are quite aware of the problem but cannot directly do anything about
it as the problem is with tcl/tk and Apple. A couple of days ago, Kevin
Walzer wrote on an IDLE-sig post "I'm currently reviewing an updated
patch to address the problem. When I commit the patch, it will go into
both Tk's trunk and in the Cocoa 8.5 backport, and eventually be
available through ActiveState's distribution."


And it's been committed:

http://core.tcl.tk/tk/info/9844fe10b9

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


MySQL: AttributeError: cursor

2012-02-11 Thread Kevin Murphy
Hi All,
I'm using Python 2.7 and having a problem creating the cursor below.
Any suggestions would be appreciated!

import sys
import _mysql

print "cursor test"

db =
_mysql.connect(host="localhost",user="root",passwd="mypw",db="python-
test")

cursor = db.cursor()

>>>
cursor test

Traceback (most recent call last):
File "C:\Python27\dbconnect.py", line 8, in 
cursor = db.cursor()
AttributeError: cursor
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-04 Thread Kevin Walzer

On 3/3/12 12:06 AM, John Salerno wrote:

I suppose the 'advantage' of this is that it will replace tk widgets
with equivalent ttk widgets, if they exist and have the same name. I
believe one has to program them differently, however, so the replacement
cannot be transparent and one mush know anyway what gets replaced and
what not.


Grr, sounds like a pain if I want to use the new widgets. Does this cause 
conflict with someone who isn't running 8.5, or will they still see the older 
widgets as normal?

I'm tempted just to go back to wxPython. Two sets of widgets in Tkinter is a 
little annoying.


The new widgets are not a drop-in replacement for the traditional Tk 
widgets. They can be used with 8.4 if the "tile" Tk extension is 
installed. This is how the ttk widgets were first deployed; they didn't 
enter Tk's core until 8.5.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: converting from tcl/tkl to python

2012-03-09 Thread Kevin Walzer

On 3/9/12 10:10 AM, Richard Boothroyd wrote:


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.

My understanding is that Python is a much better GUI tool than TCL/TKL
so I'd appreciate any insight on this assumption. Also I'm wondering
what kind of effort and expertise it would take to convert from TCL/
TKL to Python. Let me know what further info you may require.



First, don't assume that Tcl/Tk is not up to the job. I took a look at 
some of your software screenshots at your website and noticed that you 
are using the "classic" Tk widgets, which, while functional, are a bit 
dated in their appearance. Tcl/Tk 8.5 has added a separate group of 
widgets called the ttk (for "themed Tk")  widgets that are fully native 
in appearance on Windows/Mac and much improved in their appearance on 
Linux/Unix. Here's a screenshot of a Tcl/Tk app using the ttk widgets on 
Windows:


http://sourceforge.net/p/windowstoolset/screenshot/screenshot.png

If modernizing the UI is all you need to do, a careful update of your 
code using the themed Tk widgets will take you a long way, with far less 
work and cost than porting your code to Python.


Having said this, if you are seeing other issues with Tcl (lack of 
support for certain libraries/API's, code is becoming unmanagable, etc.) 
and you have concluded that Python is a superior choice overall, then 
there are a number of different routes you can take:


1. Python's built-in GUI toolkit is a wrapper for Tk called Tkinter. 
Recent versions of Python support the themed Tk widgets as well as the 
classic Tk widgets. Doing a port of your code from Tcl/Tk to Python will 
be somewhat simpler if you use Python's Tkinter library, because the 
general layout will be similar. However, there are no automated tools 
for mapping Tk to Tkinter that I am aware of--you will have to do a 
rewrite of your code.


2. Python also has bindings for many other UI toolkits, including 
wxWidgets (a very nice cross-platform toolkit that has native UI 
bindings), Qt, Gtk, and others. If you prefer a different 
design/toolkit/API, these may be worth a look. However, if you opt for 
one of these toolkits and Python, then you are essentially starting from 
scratch with your software--it will be a complete rewrite not just in 
the programming language but also in the UI design as well. That will 
take a great deal of additional time and cost.


To sum up: a rewrite of your software in Python will amount a 
major-to-complete overhaul of the code base, depending on how you 
approach the UI design--and this will involve significant cost and time. 
This may make sense if you feel you have reached the end of the line 
with Tcl and your desire for a different language is for reasons in 
addition to the look and feel of the UI. However, if your software and 
its code is otherwise satisfactory and you need simply to update the UI 
design, that can be done in Tcl at far less cost using the ttk widgets.


Hope this helps,

Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


python polygon

2012-04-05 Thread Kevin Zhang
Hi,

I found python polygon link in this page
http://pypi.python.org/pypi/Polygon/1.17 was invalid now.

http://polygon.origo.ethz.ch/download
404 - Project not found

Ooops, the subdomain is not valid because the according project does not
(yet) exist.
Go to the Origo main page at http://origo.ethz.ch

Can anyone provide some updates on this?

Thanks,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Carbon Event Manager (Carbon.CarbonEvt module) - working?

2012-05-15 Thread Kevin Walzer

On 5/15/12 3:06 PM, msmucr wrote:

Do I have something wrong or is it simply broken and unmaintained now?


Support for Carbon Events was removed in Python 3.x and it does not work 
in 64-bit, to my knowledge--most of the Carbon API's are not supported 
by Apple anymore.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Tkinter by John E Grayson

2012-05-17 Thread Kevin Walzer

On 5/16/12 11:55 PM, Mark R Rivet wrote:

  I have a copy of this book and was wondering how relevant the content
is considering the publish date is 2000. Are people still using this
information? Anyone have any experience with this book? I guess what I
mean, is, any of the code in this book deprecated? or does it still
contain information used today the same as then. I mean, I guess some
things don't change right? For instance,  the derivative of x^2 is 2x
now and in the 1800's.


Mark Lutz' "Programming Python" has extensive coverage of Tkinter (it's 
a huge book and devotes several chapters to Tkinter), and has been 
updated at regular intervals, most recently in the last year or two; 
I've found it a very helpful reference and guide to Tkinter programming.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to hide console with Popen on Windows?

2012-05-18 Thread Kevin Walzer

On 5/18/12 4:22 AM, xliiv wrote:

Like the topic, more details in followed links..


http://stackoverflow.com/questions/10637450/how-to-hide-console-with-popen-on-windows

http://code.activestate.com/recipes/409002-launching-a-subprocess-without-a-console-window/?c=14452

Please help :(
Any hint i would appreciate


There are some Windows-specific flags in the subprocess module that you 
can set to control the display of a console window. I use something like 
this:


 self.pscmd=os.path.join(execdir, 'pstools-1.1/txt2ps.exe')
   startupinfo =  subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
txtps = self.pscmd  + ' -o ' + tempfile.gettempdir() + 
'\\whois.ps' + ' ' + tmpfile

subprocess.check_output(txtps, startupinfo = startupinfo)

Hope this helps.
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Recruiting for Python Developer - Perm

2012-05-22 Thread Kevin Walzer

On 5/22/12 5:30 AM, Python Recruiter wrote:

Key skills required for this role are:
1. Python Development on Linux
2. Experienced Software Developer

Desirable:
1. AppScript
2. Adobe Illustrator


I'm in the U.S. so would not be applying for your position, but one 
thing your post neglects to mention is that competence on Mac OS X may 
also be required here. appscript is a Mac-specific technology (Python 
interface to Apple Event framework), and can be used to script Adobe 
Illustrator, which, of course, does not run on Linux.


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Question about argparse and namespace

2012-05-23 Thread Kevin Anthony
the documentation says argparse.prase_args creates a new empty namespace,
but if i pass it a existing namespace, it seems to append the arguments to
the existing namespace
An example is if it's part of a class, calling
parser.parse_args(namespace=self) doesn't seem to have any ill effects. Is
this a good idea?  is there a better way of doing this?


-- 
Thanks
Kevin Anthony

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what gui designer is everyone using

2012-06-07 Thread Kevin Walzer

On 6/5/12 10:10 AM, Mark R Rivet wrote:

I want a gui designer that writes the gui code for me. I don't want to
write gui code. what is the gui designer that is most popular?
I tried boa-constructor, and it works, but I am concerned about how
dated it seems to be with no updates in over six years.


None. I write GUI code by hand (Tkinter).

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-10 Thread Kevin Walzer

On 6/8/12 8:27 AM, Wolfgang Keller wrote:

What "GUI designer" would come the closest to the way that Cocoa's
Interface Builder works? I.e. is there any one (cross-platform) that
allows to actually "connect" the GUI created directly to the code and
make it available "live" in an IDE?


If you're developing on the Mac, PyObjC allows you to use Interface 
Builder for developing Python apps.


However, there are those of us who are deeply uncomfortable with IB and 
related tools, such as RealBasic and LiveCode/Runtime Revolution. These 
tools make code organization very hard by reducing the amount of code 
written to the point of the UI working by "magic," and/or by breaking up 
your code into little snippets that you can only view by clicking on the 
widget in the UI tool.


A related issue is that using a tool such as this makes you heavily 
dependent on that particular tool, and subject to its developers' 
priorities, release schedule, and bugs. The pace of Xcode 
development--with Apple making frequent changes to project formats in a 
backwards-incompatible way--is an example of this.


One reason I prefer to code UI's by hand is because a) in Tkinter it's 
very easy to do, and b) it allows me to have a much better mental model 
of my code and my app's functionality--I can put everything into as many 
.py files as I need to, and can edit my code with any text editor.


I think these issues are a reason that the slick "drag-and-drop" UI 
builders tend to be developed by commercial software shops to support 
their language and/or IDE, but find little traction among open-source 
developers and languages.


--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-11 Thread Kevin Walzer

On 6/11/12 8:01 AM, Wolfgang Keller wrote:

Tkinter is imho honestly the very best "argument" if you want to make
potential new users turn their backs away from Python for good. Just
show them one GUI implemented with it and, hey, wait, where are you
running to...


Yes, Tkinter GUI's are very ugly.

http://www.codebykevin.com/phynchronicity-running.png

http://www.codebykevin.com/quickwho-main.png

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   >