libdnet and python (scapy)
I am interested in using libdnet with Python, how can I go about "installing" it on windows? http://libdnet.sourceforge.net/ Ultimately, I would like to get Scapy (http://www.secdev.org/projects/scapy/) running on windows...currently it is a *nix app written in Python, so I think I should be able to get it to work on Windows, just need some help I guess. Anyone get Scapy on Windows before or libdnet? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Obfuscator for Python Code
Is there any obfuscator out there that obfuscates the python code (byte code i guess)??? -- http://mail.python.org/mailman/listinfo/python-list
py2exe + XML-RPC problem
Hi, I tried to take the Monkey Shell script (http://www.sharp-ideas.net/archives/2005/03/monkey_shell_us.html) and make it into an executable. I am making an executable for the server piece (monkey_shelld.py). So my setup.py looks like this # setup.py from distutils.core import setup import py2exe import sys import xmlrpclib import os import string from SimpleXMLRPCServer import * from ConfigParser import * sys.argv.append("py2exe") setup(console=[{"script": 'monkey_shelld.py'}], data_files=["monkey_shell.conf"]) ...which i think is right. I imported the same imports as monkey_shelld.py uses (is that necessary??) And i execute it like... python setup.py py2exe Anyhow, i run the setup and get a monkey_shelld.exe. I can run the exe and the server runs just fine. Then I connect to the server using the client (monkey_shell.py), and when I execute a command, the client side prints out an error... xmlrpclib.ProtocolError: http://mail.python.org/mailman/listinfo/python-list
distribute python script
i want to distribute my python script as an executable. I have tried py2exe but it caused a problem in my script when I ran it. I know about Gordon McMillans Installer (which is no longer hosted)..but i tried that and when i run the .exe it generated, it just crashes (i.e. Windows wants to send an error report). Pyco is gone as well. anyone? -- http://mail.python.org/mailman/listinfo/python-list
Re: distribute python script
surei posted another thread eariler, which explains much more related to py2exe..check that out and let me know if that helps. http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/4071921987be308d -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe + XML-RPC problem
update to this. I generated an exe for the client and server. They both run fine, except, when i send a command from the client to server, the cleint spits out this.. xmlrpclib.ProtocolError: When I run the .py's by themselves I do not get this. This only occurs with the generated .exe's. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe + XML-RPC problem
sorry, I am actually still getting the 500 internal error I reported earlier. thanks for ur input. -- http://mail.python.org/mailman/listinfo/python-list
Re: distribute python script
Thanks so much Thomas!!! I added encodings to my setup's...here it is setup(console=[{"script": 'monkey_shell.py'}], options={"py2exe": {"packages": ["encodings"]}}) and i did the same for the other python script. Thanks!! -- http://mail.python.org/mailman/listinfo/python-list
SimpleXMLRPCServer - turn of output
Hi, I have a simple script which starts a SimpleXMLRPCServer. A client connects to the server and executes one of the servers methods. When the server processes the request and returns it, the server prints some info out to the console, something like this.. localhost - - [14/Apr/2005 15:47:12] "POST /RPC2 HTTP/1.0" 200 - Any idea how I can prevent it from printing out? Thanks -- http://mail.python.org/mailman/listinfo/python-list
SimpleXMLRPCServer - disable output
Hi, I thought I posted this, but its been about 10min and hasnt shown up on the group. Basically I created a SimpleXMLRPCServer and when one of its methods gets called and it returns a response to the client, the server prints some info out to the console, such as, localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 - Anyhow, is there a way I can surpress that so its not printed to the console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly print that, I think perhaps std is...but not sure. Any ideas?? thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: SimpleXMLRPCServer - disable output
Jeremy Jones wrote: > codecraig wrote: > > >Hi, > > I thought I posted this, but its been about 10min and hasnt shown up > >on the group. > > Basically I created a SimpleXMLRPCServer and when one of its methods > >gets called and it returns a response to the client, the server prints > >some info out to the console, such as, > > > >localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 - > > > >Anyhow, is there a way I can surpress that so its not printed to the > >console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly > >print that, I think perhaps std is...but not sure. Any ideas?? > > > >thanks. > > > > > > > Here's the entire SimpleMLRPCServer class from SimpleXMLRPCServer.py: > > > class SimpleXMLRPCServer(SocketServer.TCPServer, > SimpleXMLRPCDispatcher): > """Simple XML-RPC server. > > Simple XML-RPC server that allows functions and a single instance > to be installed to handle requests. The default implementation > attempts to dispatch XML-RPC calls to the functions or instance > installed in the server. Override the _dispatch method inhereted > from SimpleXMLRPCDispatcher to change this behavior. > """ > > def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, > logRequests=1): > self.logRequests = logRequests > > SimpleXMLRPCDispatcher.__init__(self) > SocketServer.TCPServer.__init__(self, addr, requestHandler) > > You should be able to change logRequests to 0 and that should fix it. I just tested it at a prompt and it worked just fine. > > > Jeremy Jones Jeremy, So can you explain what I can do to set logRequests = 0? Do i just do.. server = SimpleXMLRPCServer(0) ??? I am sorta new to python thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: SimpleXMLRPCServer - disable output
Jeremy, Thanks for clearing that up. I am so used to java (i.e. foo.setLogRequests(0))...that I forgot I could just do, foo.logRequests = 0. Learning one day at a time :) Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Python - interpreted vs compiled
Hi, I have a question about Python. I know that it is an interpreted language, meaning a python program is converted to binary on the fly each time it is run, or compiled. What would be the purpose of compiling? I guess the compiled python code (question, is compiled python code called byte code?..if not, what is it called?) is not readable since it is not plain text, which may be a reason for compiling...but why else?? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python - interpreted vs compiled
thanks. -- http://mail.python.org/mailman/listinfo/python-list
Determine ip address
hi, how can i use python to figure the ip address of the machine which the python script is running on? I dont mean like 127.0.0.1but i want the external IP address (such as ipconfig on windows displays). any ideas?? THanks -- http://mail.python.org/mailman/listinfo/python-list
Get OS name
How can I get the OS Name, such as "Windows XP Pro". I know I can do sys.getwindowsversion but that doesnt return a nice Windows XP Pro string. and os.name gives "nt" thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python appropriate for web applications?
for more information on web application frameworks check out http://pyre.third-bit.com/pyweb/ It is a project aimed at helping web app developers to figure out which frameworks to use, etc. good luck! -- http://mail.python.org/mailman/listinfo/python-list
Re: Get OS name
i guess i wanted the result in a nice string like Windows XP instead of 5.1 i guess i'll have to convert it myself, thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Get OS name
where can I get wmi module, it doesnt come with Python right? thanks. -- http://mail.python.org/mailman/listinfo/python-list
py2exe - create one EXE
Hi, Is there a way to create one .exe using py2exe (or some other extension/utility that can do it)? Basically i want to generate one .exe that contains everything my python app needs to run instead of having a .exe, some .zips, etc. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Get OS name
my requirements for getting the OS info havent changed. My first message says "How can I get the OS Name, such as "Windows XP Pro"." that's what I wanted all along. thanks for the information anyway, i believe platform is better than my previous approach. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
must have missed it on py2exe front pageand for google i didnt try that search exactly. Thanks though. I was trying like "one executable py2exe", etc. -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
I tried the installer v6...and i generated a spec, and i built the exe...when i run the exe i get a error popup window from Windows asking me to send an Error report. The warnings that were generated during the build all appear to be "ignorable" as the documentation mentions. any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
oh and Fredrik, i tried the SingleInstaller linkwhich points to a script using NSIS. I followed those instructions which generated an .exe. HOwever, when i run the .exe nothing happens (meaning no process starts, no output, no errors, nothing). any ideas on that? have ever used it? -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
So how there is currently available way to have 1 .exe which includes everything needed to run a python app? :sigh: -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
fredrik... any ideas on my last post? (copied below for u) oh and Fredrik, i tried the SingleInstaller linkwhich points to a script using NSIS. I followed those instructions which generated an .exe. HOwever, when i run the .exe nothing happens (meaning no process starts, no output, no errors, nothing). any ideas on that? have ever used it? thanks -- http://mail.python.org/mailman/listinfo/python-list
Tkinter & Tkconstants
Hi, I was reading through the Tkinter tutorial at http://www.pythonware.com/library/tkinter/introduction/index.htm ...and it mentions that by doing, from Tkinter import * you have access to the constants in Tkconstants, since Tkinter imports it automatically. However, in the shell if I do.. from Tkinter import * print Tkinter.HORIZONTAL I get an error..NameError: Tkinter is not defined any ideas? However, if I do, import Tkconstants print Tkconstants.HORIZTONAL I get what i expect. but according to the tutorial i should only need Tkinter. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Tkinter Event Types
Hi, When I do something like. s = Scale(master) s.bind("", callback) def callback(self, event): print event.type I see "7" printed out. Where are these constants defined for various event types? Basically i want to do something like... def callback(self, event): if event.type == ENTER: print "You entered" thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter & Tkconstants
nevermind, i should access it by HORIZONTAL not Tkinter.HORIZONTAL since I imported everything from Tkinter already. Thanks anyway -- http://mail.python.org/mailman/listinfo/python-list
Update Label when Scale value changes
Hi, I am using Tkinter and I have a Label and a Scale. I want to update my label everytime the Scale value changes. What is the best way of doing this? Do i have to bind for every event type? Or is there some better way? If I do have to bind each type of event to the scale, what types occur for a Scale? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Update Label when Scale value changes
Yea that is what i needed. Can you recommend a good Tkinter site (or book, but preferably site) about learning Tkinter. I've tried: http://www.python.org/moin/TkInter http://www.pythonware.com/library/tkinter/introduction/ But I am looking for more about events, etc. Thanks -- http://mail.python.org/mailman/listinfo/python-list
XML-RPC -- send file
Hi, I want to use XML-RPC to send a file from client-to-server or from server-to-client. I know XML-RPC supports, int, string etc...not objects. I thought i read somewhere that by using pickle or something, that u could get a string representation of your object (or a file in my case) and send that. Any ideas? thanks. -- http://mail.python.org/mailman/listinfo/python-list
Tkinter and Scrollbar
Hi, I am trying to use a Scrollbar for a Listbox. I want a scrollbar which which has the vertical and horizontal scroll bars. Here is how i am doing it now, is the only way or "best" way to do it? # vertical scroll bar for list self._scrollbarY = Scrollbar(self.myContainer) self._scrollbarY.pack(side=RIGHT, fill=Y) # horizontal scroll bar for list self._scrollbarX = Scrollbar(self.myContainer, orient=HORIZONTAL) self._scrollbarX.pack(side=BOTTOM, fill=X) self._list = Listbox(self.myContainer) self._list.pack() for i in range(100): self._list.insert(END, "a"*i) self._list.config(yscrollcommand=self._scrollbarY.set) self._list.config(xscrollcommand=self._scrollbarX.set) self._scrollbarY.config(command = self._list.yview) self._scrollbarX.config(command = self._list.xview) Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC -- send file
how would I decode it? -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC -- send file
Experient I have been :) Here is what I am getting now CLIENT --- d = xmlrpclib.Binary(open("C:\\somefile.exe").read()) server.sendFile(d) SERVER -- def sendFile(tmp): print "FILE:", tmp The server receives the file, because it prints it out, but on the client I get this xmlrpclib.Fault: so it sends it, but the client is getting an error. The error occurs on the, server.sendFile(d) line. any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC -- send file
stefan: i added, "return 1" to my sendFile method on the server...took care of the error, thanks. f. petitjean: i cleaned up my code by closing the file, however, when i tried your exact code above...i got stuck an infinite loop and my PC speaker beeped over and over :) thanks. -- http://mail.python.org/mailman/listinfo/python-list
Define Constants
Hi, I have a question about how to define constants. My directory structure looks like... C:\ --> abc.py --> utils --> __init__.py --> CustomThing.py Ok, CustomThing looks like... TOP = 0 LEFT = 1 class CustomThing: def __init__(self): self.foo = "foo" so, from abc.py I have from utils.CustomThing import CustomThing print CustomThing.TOP but i get an error: AttributeError: class 'CustomThing' has no attribute 'TOP' How can I access those?? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Define Constants
Thanks for the input. i am renaming my module to be customthing. I noticed that is how many python modules are, so I will stick to the "convention". Thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list
Private class?
Hi, First, I come from a Java background. Ok, so I have this idea that I want to create an EventBus...basically a central class where objects can register themselves as listeners for different events. This central class also has methods so that objects can fire events. Something like this... Say we have object MrTree and object MotherNature. MrTree listens for EVENT_GROW_LEAVES. So, when MrTree "hears" about EVENT_GROW_LEAVES, MrTree will do just that, grow some leaves. So, while our python app is running, MotherNature needs to tell MrTree to grow leaves. I am suggesting something like this... 1. MrTree has a method, growLeaves() 2. MrTree registers for the event, EventBus.register(MrTree, EVENT_GROW_LEAVES) 3. MotherNature fires grow leaves, EventBus.fire(EVENT_GROW_LEAVES) 4. MrTree's growLeaves method gets called by EventBus. Now, in Java I would make EventBus a Singleton so that only one instance of it would exist. And I would have MrTree implement EventListener interface, where the interface defines a method like growLeaves(). So when MotherNature tells the EventBus to fire the event, EventBus loops through it's list of listeners and calls, growLeaves() How would I go about doing this in Python? Here is my quick idea class EventListener: def eventOccurred(self, eventType): pass class MrTree(EventListener): def __init__(self): EventListener.__init__(self) EventBus.register(self, EventBus.EVENT_GROW_LEAVES) def eventOccurred(self, eventType): if eventType == EventBus.EVENT_GROW_LEAVES: print "Growing Leaves" class EventBus: EVENT_GROW_LEAVES = 0 __listeners = {} def register(listener, eventType): if __listeners.has_key(eventType): curListeners = __listeners.get(eventType) curListeners.append(listener) else: __listeners[eventType] = [listener] def fire(eventType): if __listeners.has_key(eventType): x = __listeners.get(eventType) for l in x: l.eventOccurred(eventType) class MotherNature: def doSomeStuff(): print "doing whatever Mother Nature does..." EventBus.fire(EventBus.EVENT_GROW_LEAVES) ...so that is what I am thinking. However, i guess my issue is how to make EventBus a singleton or prevent it from being instaniated and making it's methods statically accessible. thanks. -- http://mail.python.org/mailman/listinfo/python-list
python classes/file structure
What is the best/common way to structure ur python code for an application? For example...if I create some custom GUI widgets I have this C:\stuff --> gui --: MyCustomWidget.py --: TestWidgets.py so MyCustomWidget.py has one class, class MyCustomWidget: ... so from TestWidgets.py i have to do this from gui import * widget = gui.MyCustomWidget.MyCustomWidge() ...seems weird, how should I structure this? Is it not common to have one class in a .py? thanks -- http://mail.python.org/mailman/listinfo/python-list
Regular Expressions - Python vs Perl
Hi, I am interested in regular expressions and how Perl and Python compare. Particulary, I am interested in performance (i.e. speed), memory usage, flexibility, completeness (i.e. supports simple and complex regex operations...basically is RegEx a strong module/library in Python?) Anyone have any information on this? Any numbers, benchmarks? Thanks so much. I know this is a python user group...but try to be has un-biased as you can. -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expressions - Python vs Perl
Well so far from what I have found, Perl is faster than Python for RegEx, although perl is harder to read. -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expressions - Python vs Perl
I found some benchmarking (perhaps simple) but search for "The Great Computer language shootout" look at the original shootout and the win32 one. Thomas: "I doubt the total execution time for all the RegEx queries you ever ran took as much time as you just wasted on your little experiment. " .no need to be angry. I don't have some "little experiment", but thanks for being concerned about me wasting my time. I do understand that python is certainly easier to read, no doubt. I was just doing some research to find out about speed/performance between the two. But thanks for pointing out, again, that Pyton is easier to read. (let's just not forget that python is great for other things other than just readability.) -- http://mail.python.org/mailman/listinfo/python-list
Re: python classes/file structure
Thanks, but I am not familiar with the "__all__" variable, could u give me an example? Without using, __all__would i do this in my __init__.py? import MyCustomWidget1 import MyCustomWidget2 import MyCustomWidget3 etc? -- http://mail.python.org/mailman/listinfo/python-list
Re: python classes/file structure
also is it common to have one class per file? seems weird to have, MyCustomWidget.MyCustomWidget thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expressions - Python vs Perl
Thanks for the input. I was just looking for some feedback about which was better and faster, if an answer exists. However, I am not choosing Perl or Python b/c of it's RegEx engine as someone mentioned. The question was just because I was curious, sorry if I misled you to think I was choosing which language to program with based on the RegEx performance. Also, I was not choosing based on performance...I just wanted to know how they compared. -- http://mail.python.org/mailman/listinfo/python-list
__init__.py question
Ok, I have the following directory structure C:\pycode --> blah.py --> mynewdir --> __init__.py --> abc.py [[ C:\pycode\mynewdir\abc.py ]] def doFoo(): print "hi" def doBar(): print "bye" [[ C:\pycode\mynewdir\__init__.py ]] from mynewdir import * [[ C:\pycode\blah.py ]] what do i import in blah.py so that I can accesss, abc.doFoo() ? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: figuring out # of bytes
so each character in the string is 1 byte? if so, can u point me to somewhere that states that perhaps? thanks -- http://mail.python.org/mailman/listinfo/python-list
Read / Write image file
I have a image file on my pc, say a .jpg. Basically I want to setup a client/server socket, and I want the client to read in the jpg and send it to the server, where the server can write that data into a new file on the server. I tried just doing something like.. x = open("abc.jpg") y = x.read() tmp = open("newFile.jpg", "w") tmp.write(y) tmp.close() x.close() ...but that doesn't give me a copy of abc.jpg any ideas? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Read / Write image file
thanks Phil, the problem was that I was not using "rb" and "wb". thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Read / Write image file
By the way, what is 'rb' and 'wb' ? Also, when I create a client/server sockets I do something like... SERVER --- server.bind(('', 4321)) (sock, addr) = server.accept() x = server.recv(1024) CLIENT client.connect(('localhost', 4321)) x = open("abc.txt", "rb") client.send(x) client.close() x.close() ...when I do this I get a constant beeping on my PC, any idea why? Also, on the server ...how can I set that up so I can receive a file/data of unknown size instead of just 1024? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Read / Write image file
well on the server, if I have, x = sock.recv(1024) and the client sends more than 1024 bytes...the server won't receive it all right? So I am wondering, how do I setup the server to handle some unknown amount of data? Note, in previous post it should have been, x = sock.recv(1024) not x = server.recv(1024) thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Read / Write image file
so something like, x = sock.recv(1024) while (len(x) > 0): # do stuff x = sock.recv(1024) ?? So what if the client sends 4 bytes, and then sends 8000 bytes? WIll I get the first 4 bytes as a separate msg so to speak? Basically i want to catch each message from the client as a whole. -- http://mail.python.org/mailman/listinfo/python-list