Python Socket Issues with VirtualBox

2009-05-22 Thread TechieInsights
I have created a server and client that communicate via a TCP socket connection. Everything runs great on 6 of the 6 boxes. However, when I installed Sun's VirtualBox on one of the PC's I started getting: error: (10061, 'Connection refused') I tried restarting, stopping services, checking out a

Re: Spam

2009-02-12 Thread TechieInsights
On Feb 12, 10:23 am, Tim Chase wrote: > > If you subscribe to C.P.L as a mailing list instead of a > > newsgroup, I believe most of the spam gets filtered out at the > > mailing list<->news group gateway by the Python.org spam > > filters... At least no spam in my Gmail spam folder appears to > >

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
Ok... for some closure I have written a class to automate the process. It takes getters and setters and deleters and then sets the property automatically. Sweet! class AutoProperty(type): def __new__(cls, name, bases, methoddict): processed = [] getter =

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
On Feb 12, 9:27 am, josh logan wrote: > On Feb 12, 10:58 am, TechieInsights wrote: > > > > > Oh... one other thing that would be really cool is to do this with AOP/ > > descriptors!  I just haven't been able to get that to work either. > > Basics... >

Re: Embarrasing questio

2009-02-12 Thread TechieInsights
On Feb 12, 9:19 am, Michele Simionato wrote: > On Feb 12, 5:07 pm, TechieInsights wrote: > > > On Feb 12, 9:03 am, Catherine Heathcote > > > wrote: > > > But I just cant find it. How do I do an or, as in c/c++'s ||? Just > > > trying to do something

Re: Embarrasing questio

2009-02-12 Thread TechieInsights
On Feb 12, 9:03 am, Catherine Heathcote wrote: > But I just cant find it. How do I do an or, as in c/c++'s ||? Just > trying to do something simple, the python equivilent of: > > if(i % 3 == 0 || i % 5 == 0) > > Thanks. in 2.5 and above you can do if any(i%3 == 0, i%5 == 0) -- http://mail.python.

Re: Embarrasing questio

2009-02-12 Thread TechieInsights
On Feb 12, 9:03 am, Catherine Heathcote wrote: > But I just cant find it. How do I do an or, as in c/c++'s ||? Just > trying to do something simple, the python equivilent of: > > if(i % 3 == 0 || i % 5 == 0) > > Thanks. if i % 3 == 0 or i % 5 == 0 -- http://mail.python.org/mailman/listinfo/pyth

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
Oh... one other thing that would be really cool is to do this with AOP/ descriptors! I just haven't been able to get that to work either. Basics... @readonly class MyClass(object): def __init__(self, x): self.set_x(x) def get_x(self): return self._

Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
Ok, so I noticed some of the modules (such as many of the datetime attributes) are read-only, which means the __setattr__ and __set__ methods are intercepted... pretty easy. I am looking for a way to automate this. The real goal is not to have read only attributes, but to have getters and setters

Client Socket Connection to Java server

2009-01-15 Thread TechieInsights
I am having problems with a socket connection to a Java server. In java I just open the socket, pass the length and then pass the bits across the socket. I created a socket object: import socket class MySocket: def __init__(self, host='localhost', port = 28192, buffsize = 1024):

Re: replacement for __file__ in compiled exe

2009-01-05 Thread TechieInsights
wrote: > On Jan 6, 7:03 am, TechieInsights wrote: > > > __file__ command does not work when compiled to exe.  It makes since > > because the file is now in a compressed library.  Is there a > > replacement or something else you can do?  The real problem is that > >

Re: __init__.py and package help

2009-01-05 Thread TechieInsights
Thanks J. Cliff Dyer wrote: > On Mon, 2009-01-05 at 11:49 -0800, TechieInsights wrote: > > Ok I have read all of the tutorials and documents I could find. I am > > running Python 2.6 on windows. The problem I am having with packages > > is that they don't show up! >

replacement for __file__ in compiled exe

2009-01-05 Thread TechieInsights
__file__ command does not work when compiled to exe. It makes since because the file is now in a compressed library. Is there a replacement or something else you can do? The real problem is that when you create an exe of your program with python embedded, you can't always guarantee that your cur

Re: __init__.py and package help

2009-01-05 Thread TechieInsights
Ok... I figured it out... you can only import packages via the __all__ = ['subpackage/folder']... if you include a module such as hello.py, it will fail. Go figures I'd find this right after posting here... Greg TechieInsights wrote: > Ok I have read all of the tutorials and

__init__.py and package help

2009-01-05 Thread TechieInsights
Ok I have read all of the tutorials and documents I could find. I am running Python 2.6 on windows. The problem I am having with packages is that they don't show up! Simple example of what isn't working... Structure- pytest/ Root directory of package __init__.py- code: __all__ = ['folder']

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread TechieInsights
You can use the built-in string formatting options and operations. 2.5: http://www.python.org/doc/2.5.2/lib/typesseq-strings.html 2.6: http://docs.python.org/library/string.html In essence, you can do: print "You still have $%i remaining" %(money) On Jan 2, 2:15 pm, sprad wrote: > I've done a g

Re: is there a way to determine a relative path to the script?

2009-01-02 Thread TechieInsights
Note: The os.path.relpath is new in 2.6. If you are using an older version you will have to write your own algorithm TechieInsights wrote: > import os > os.path.relpath('/path/to/your/file', os.path.dirname(__file__)) > > tekion wrote: > > Hello, > >

Re: is there a way to determine a relative path to the script?

2009-01-02 Thread TechieInsights
import os os.path.relpath('/path/to/your/file', os.path.dirname(__file__)) tekion wrote: > Hello, > I have a script in /usr/local/app/mypython.py and a configuration file > relative to /usr/local/app/conf. When I call the script with an > absolute path of /usr/local/app/mypthon.py I recieved an