What are new-style classes?
I recently heard about 'new-style classes'. I am very sorry if this sounds like a newbie question, but what are they? I checked the Python Manual but did not find anything conclusive. Could someone please enlighten me? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: list problem 4 newbie
Hi, if u check the id's of a and b lists and also its elements, you will obeserve that the id's of a and b have changed but id's of their elements have not changed. If you make a deep copy of the list a and then make your changes in that list, it shud work. this can be done using the copy module. hope that helps, vaibhav >>> id(a) -1208622388 >>> id(b) -1208622324 >>> for el in a: ... print id(el) ... -1208622836 -1208622708 -1208622772 -1208622420 >>> for el in b: ... print id(el) ... -1208622836 -1208622708 -1208622772 -1208622420 >>> import copy >>> c = copy.deepcopy(a) >>> id(c) -1208464564 >>> for el in c: ... print id(el) ... -1208465172 -1208464276 -1208464180 -1208463988 -- http://mail.python.org/mailman/listinfo/python-list
Re: import woe
Hi bob,
1. decide the directory which will be your root folder containing foo
[/home/ROOT/foo/]
2. work out your directory structure relative to this root folder
here it is ->ROOT->foo->car.py
->bar->far.py
->bar->jar.py
3. add __init__.py file inside each folder containing a list variable
__all__ with contents as the name of the directories and classes
so foo folder should contain a file called __init__.py which has the
following contents
__all__ = ['bar','car']
and bar folder should contain a file called __init__.py which has the
following contents
__all__ = ['far','jar']
4. add the root folder to your sys.path
so your jar.py file should have the following entries
from sys import path
path.append('../../../ROOT')
note: i prefer relative paths or make paths using os.getcwd
combinations in such situations, which makes the class more flexible.
you can also do this step where u configure/initialize
5. then you can import the classes you want in jar.py
from foo import car
from foo.bar import far
pls mail if u dont get it working/any doubts.
-
vaibhav
--
http://mail.python.org/mailman/listinfo/python-list
Re: who can give me the detailed introduction of re modle?
easy and convenient way to get a good introduction for any module [especially if ur stuck and dont have internet connectivity]: 1. start python interpreter $ python 2. import the module and ask it for help :-) >>> import re >>> help(re) -vaibhav -- http://mail.python.org/mailman/listinfo/python-list
Regarding 3D buttons in PyQT5
Hi, I want to know that how can i create 3D buttons in PyQT5 window or an animated button. Regards Vaibhav -- https://mail.python.org/mailman/listinfo/python-list
export opengl context to pdf
Hi, Does anyone know of a package that will allow me to output an opengl context as a PDF (or postscript)? I am using pyglet to render something on screen that i want to save as PDF. thanks! vaibhav -- http://mail.python.org/mailman/listinfo/python-list
export opengl context to pdf
Hi, Does anyone know of a package that will allow me to output an opengl context as a PDF (or postscript)? I am using pyglet to render something on screen that i want to save as PDF. thanks! vaibhav -- Vaibhav Bhawsar -- http://mail.python.org/mailman/listinfo/python-list
Executing a C program from Python
Hi,
I am very new to python. I have my cgi script written in Python. My CGI script
should call a C program and collect the value returned by this program and pass
it to the browser.
Can anyone help me out in this. How can I execute the c program and collect the
return value.
I tried,
import os
a=os.system("my-app")//my-app is the C program executable
print a
But the variable a prints 0 everytime. It should return a non-zero value as per
my C program. Is there any method to do what I need.
Regards,
vish
--
http://mail.python.org/mailman/listinfo/python-list
error in SimpleXMLRPCServer
hi,
I create a SimpleXMLRPCServer script which execute the command on server
and return the result.
code is below
accessList=(
'test.org'
)
class Server(SimpleXMLRPCServer.SimpleXMLRPCServer):
def __init__(self,*args):
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self,(args[0],args[1]))
def server_bind(self):
self.socket.setsockopt(socket.SOL_SOCKET,
socket.SO_REUSEADDR, 1)
SimpleXMLRPCServer.SimpleXMLRPCServer.server_bind(self)
def verify_request(self,request, client_address):
if client_address[0] in accessList:
return 1
else:
return 0
class xmlrpc_registers:
def __init__(self):
self.python_string = string
def clientfun(self,argument):
try:
cmd = argument
(stdin,stdout,stderr)=popen3(cmd)
stdin.close()
value2=stdout.read()
value3=stderr.read()
stdout.close()
stderr.close()
output = {"stdout":value2,"stderr": value3}
return output
if __name__ == "__main__":
if (len(sys.argv) == 3):
try :
servername=sys.argv[1]
portnumber=int(sys.argv[2])
server = Server(servername,portnumber)
server.register_instance(xmlrpc_registers())
server.serve_forever()
except Exception,e:
print "Root service is shutting down .."
print str(e)
else:
print "Please provide <\"hostname or ip\"> <\"portnumber\">"
this server side code i run in background using nohup
from client when i call function it execute fine but after some time when i
call it gives following error
and server program killed.
please help
--
http://mail.python.org/mailman/listinfo/python-list
[no subject]
hi, I wrote a python program and import the function and executing , that fuction get executing as the current uid what i have to do if i want to exectue that function as root or another user . -- http://mail.python.org/mailman/listinfo/python-list
