I have a number of python processes which communicate with each other through
writing/reading config text files. The python ConfigParser is used. I am
wondering if it is more CPU-efficient to switch to using sqlite database
instead of using configuration files. If the software does plenty of
re
Python is my favorite language. Very often, I am forced to use other languages
like php because of better library support for web applications. Is it possible
to write functions in python and then get php to call these functions?
Thank you
--
https://mail.python.org/mailman/listinfo/python-list
Python scripts can run without a main(). What is the advantage to using a
main()? Is it necessary to use a main() when the script uses command line
arguments? (See script below)
#!/usr/bin/python
import sys
def main():
# print command line arguments
for arg in sys.argv[1:]:
pri
the file
except Exception, errObj:
print Exception
print errObj
file.close() # close file and FTP
session.quit()
On Tuesday, November 19, 2013 6:18:07 PM UTC+8, JL wrote:
> I have the following code;
>
>
>
> try:
>
> session
I have the following code;
try:
session = FTP(ftp_server_ip,ftp_user,ftp_password)
file = open(filename,'rb') # file to send
session.storbinary('STOR ' + filename, file) # send the file
except Exception, errObj:
print Exception
print errObj
On Saturday, November 16, 2013 8:22:25 AM UTC+8, Mark Lawrence wrote:
> Yes but please don't top post. Actually print is a statement in Python
> 2 so your code should work if you use
> from __future__ import print_function
> at the top of your code.
> Would you also be kind enough to read and ac
15, 2013 at 1:29 PM, JL wrote:
>
> > One of my favorite tools in C/C++ language is the preprocessor macros.
>
> >
>
> > One example is switching certain print messages for debugging use only
>
> >
>
> > #ifdef DEBUG_ENABLE
>
> > DEBUG_PRINT
One of my favorite tools in C/C++ language is the preprocessor macros.
One example is switching certain print messages for debugging use only
#ifdef DEBUG_ENABLE
DEBUG_PRINT print
#else
DEBUG_PRINT
Is it possible to implement something similar in python? Thank you.
--
https://mail.python.org/
I am actually running python on raspberry pi. The trigger event is a
button-press.
On Monday, November 11, 2013 6:56:03 PM UTC+8, Dave Angel wrote:
> On Mon, 11 Nov 2013 01:41:58 -0800 (PST), JL
>
> wrote:
>
> > - If the event happens again before the 5secs expire, the h
I am trying to implement a multivibrator function with python. This is how it
works;
- An trigger event happens
- Upon receiving the event, a variable goes high for 5secs, then go low.
- If the event happens again before the 5secs expire, the high duration will be
extended by another 5 secs. Th
What is the difference between running multiple python scripts and a single
multi-threaded script? May I know what are the pros and cons of each approach?
Right now, my preference is to run multiple separate python scripts because it
is simpler.
--
https://mail.python.org/mailman/listinfo/pytho
If the game runs normally without IDLE, then, to run it from IDLE, add
pygame.quit() at the end of the script:
if __name__ == "__main__":
MainWindow = PyManMain()
MainWindow.MainLoop()
pygame.quit()
... and just before the sys.exit():
def MainLoop(self):
"""This is the Ma
I added the following method to the 2 subclasses of
asyncore.dispatcher and asynchat.async_chat and now pickle works:
def __getstate__(self):
return
Later I will probably modify this method so it returns something more
interesting.
Thanks for your help! I was confused because I am not
> Is this a subclass? Look at the parent classes.
Its class is a subclass of a similar class, but it indirectly
references instances of subclasses of asyncore.dispatcher or
asynchat.async_chat. I don't think there are other particular classes.
If I remove the first references, pickle works. A
Hello,
I am trying to pickle an object, and I get:
TypeError: a class that defines __slots__ without defining
__getstate__ cannot be pickled
I didn't find __slots__ in the object or the class. Is there a way to
find it, or to to know which object or class causes the problem?
Thanks
--
http://
15 matches
Mail list logo