Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Protected message
Your file is attached.-- http://mail.python.org/mailman/listinfo/python-list
www.python.org down
Yes, we know that www.python.org is down. Please be patient. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death." --GvR -- http://mail.python.org/mailman/listinfo/python-list
www.python.org down - power outage
Yes, we know that www.python.org is down. XS4ALL is suffering a power outage. Yes, they have backup and redundant power, but it's not working properly for the segment of the building the web server is located in. Fortunately, mail.python.org is located in a different part of the building, which is still getting power. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death." --GvR -- http://mail.python.org/mailman/listinfo/python-list
VIRUS ALERT: W32/Mydoom.O@mm
This is a notice from Inter-netcom Mail Server. You sent an email infected with a virus. Please take action and clean your computerReceived: (qmail 12701 invoked from network); 5 Dec 2004 21:41:05 - Received: from corporativo?16780-209.pool.etb.net.co.80.167.65.in-addr.arpa (HELO python.org) (65.167.80.209) by ns.internet.com with SMTP; 5 Dec 2004 21:41:05 - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Returned mail: Data format error Date: Sun, 5 Dec 2004 18:25:00 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_NextPart_000_0006_6F3805A9.6E84F71B" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600. X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; name="[EMAIL PROTECTED]" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="[EMAIL PROTECTED]" -- http://mail.python.org/mailman/listinfo/python-list
Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
python.org mail flowing again
Thanks to Thomas Wouters for quickly getting mail.python.org back up once he was notified. The mail backlog seems to be mostly finished. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarettes, it's dark, and we're wearing sunglasses." "Hit it." -- http://mail.python.org/mailman/listinfo/python-list
How to connect to a website?
Hi, i just try to connect to a website, read that page and display the rules get from it. Then i get this error message: File "D:/Python/Py projects/socket test/sockettest.py", line 21, in fileobj.write("GET "+filename+" HTTP/1.0\n\n") io.UnsupportedOperation: not writable My code: # import sys for handling command line argument # import socket for network communications import sys, socket # hard-wire the port number for safety's sake # then take the names of the host and file from the command line port = 80 host = 'www..nl' filename = 'index.php' # create a socket object called 'c' c = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connect to the socket c.connect((host, port)) # create a file-like object to read fileobj = c.makefile('r', 1024) # Ask the server for the file fileobj.write("GET "+filename+" HTTP/1.0\n\n") # read the lines of the file object into a buffer, buff buff = fileobj.readlines() # step through the buffer, printing each line for line in buff: print (line) I started with invent games with python (book 1 & 2) Now I want to write a multiplayergame, which connects to a website, where all players and gamedata will be stored/controlled. Players need to subscribe and to login via the game software. (executable, made from python script) Sending gamedata preferable in JSON, because of low traffic resources then. No idea about how authentication proces should be done I made many searches with Google, but got confused about my first steps. I am new to python, but code for many years in php/mysql. Spent most time in an online chessgame project. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to connect to a website?
thanks! solved with: import urllib.request import urllib.parse user = 'user' pw = 'password' login_url = 'http://www.riskopoly.nl/test/index.php' data = urllib.parse.urlencode({'user': user, 'pw': pw}) data = data.encode('utf-8') # adding charset parameter to the Content-Type header. request = urllib.request.Request(login_url) request.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8") f = urllib.request.urlopen(request, data) print(f.read().decode('utf-8')) And then i get next answer: Array ( [pw] => password [user] => user ) Solved and thanks again:) -- http://mail.python.org/mailman/listinfo/python-list
How to get JSON values and how to trace sessions??
Hi all, from python I post data to a webpage using urllib and can print that content. See code below. But now i am wondering how to trace sessions? it is needed for a multiplayer game, connected to a webserver. How do i trace a PHP-session? I suppose i have to save a cookie with the sessionID from the webserver? Is this possible with Python? Are their other ways to keep control over which players sends the gamedata? Secondly, can i handle JSON values? I know how to create them serverside, but how do i handle that response in python? Thank you very much for any answer! Code: import urllib.request import urllib.parse user = 'user' pw = 'password' login_url = 'http://www..nl/test/index.php' data = urllib.parse.urlencode({'user': user, 'pw': pw}) data = data.encode('utf-8') # adding charset parameter to the Content-Type header. request = urllib.request.Request(login_url) request.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8") f = urllib.request.urlopen(request, data) print(f.read().decode('utf-8')) -- http://mail.python.org/mailman/listinfo/python-list
how to: multiplayer game connecting to central server effectively?
hi, I struggle for some days about a "model" for a multiplayer game application. I read so much from my enemy Google, i got lost by all that info and dont know which path i should chose. a multiplayer game application, sending/receiving instantly every change in the game to a central webserver, http://www.x.com, probably via socket connection? which system/module should i use for this contineous connection and where can i find a good tutorial, which a beginner like me can understand a bit? (i have read too many too complicated/technical artickles, but no nice tutorials). i have tried and accompished an urllib connection, with get and post variabels, but that will be polling, with all the http-overhead for every poll. I think this is also to slow and no "real" updating of the game status. Thanks in advance for any hint/tutorial i get:) -- http://mail.python.org/mailman/listinfo/python-list
Re: how to: multiplayer game connecting to central server effectively?
The idea is a risk game application and data collected and controlled by a gameserver, which happens to be a webserver too. But for learning the principles, i want to start with tic-tac-toe multiplayer. Thanks for your answers, I will read all your advices first now. -- http://mail.python.org/mailman/listinfo/python-list
Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
Automatic response to your mail (Error)
The automatic reply to this e-mail which you should have received in response to your e-mail to [EMAIL PROTECTED] has not been defined. Please contact [EMAIL PROTECTED] for assistance. -- http://mail.python.org/mailman/listinfo/python-list
Tutorial Forum
Come check out http://www.thetutorialspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6 fails on compiling > Bug report
hi, thanks for your help. May the diff file is wrong? on my system it doesn't work. Well, set the -enable-universalsdk= path occurs that error. Hmm. that is really a disaster, isn't it :( hm. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6 fails on compiling > Bug report
Hi! :) >Sorry, there were a few line wrap-arounds in the diff file due to long >lines but the changes for the four significant lines should be easy to >do manually. Hadn't done that before but I found a ressource how to read that syntax. x86_64 would be enough. i test that again. Thank you. :) -- http://mail.python.org/mailman/listinfo/python-list
Python 2.6.1 @executable_path
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path? I don't know how the configure command would look like. This is my current configure command for the default /Library/ Frameworks/ path: ./configure --with-framework-name=Python --with-universal-archs=all -- enable-framework --enable-universalsdk=/ Can anyone help me? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Python 2.6.1 @executable_path
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path on MacOSX? I don't know how the configure command would look like. This is my current configure command for the default /Library/ Frameworks/ path: ./configure --with-framework-name=Python --with-universal-archs=all -- enable-framework --enable-universalsdk=/ Can anyone help me? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Python 2.6.1 @executable_path
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path on Mac OSX Leopard 10.5.x. I found out that I could use @executable_path but I don't know how the configure command would look like. This is my current configure command for the default /Library/ Frameworks/ path: ./configure --with-framework-name=Python --with-universal-archs=all -- enable-framework --enable-universalsdk=/ Can anyone help me? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
I want to embedd it into another app so on the 'customers'-mac I want to put python into a subdirectory of my app. bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
I want to embedd it into my app so on the 'customers'-mac I want to put python into a subdirectory of my app. and with the configure command above, that will not work because the library has to be on every system in /Library/Framework/ so I found out that @executable_path is replaced by the path of the app. bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
Thanks for the link but I don't want to do a make a python script as an applicatin, I want to embedd python into a C++ app so thats the reason why I have to compile Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
hmm.. very strange. Is it so complicated to compile python that I can move the framework to the app folder? hmm. thats really strange :-( /myapp.app /subfolder/Python.framework any suggestions? Thank you very muc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
Hi! :) Thank you. I found PySys_SetPythonHome() to set the path where the lib folder of Python is, but I guess they are not really implemented because they are fixed compiled for an absolute path, aren't they? Thats the whole problem. Do you have a suggestoin for the command line how I can build it? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
Thank you, I found PySys_SetPythonHome() to set the path where the lib folder of Python is, but I guess they are not really implemented because they are fixed compiled with an absolute path, aren't they? Thats the problem. I hadn't compiled Python and I don't know if I should compile it as a dylib file or a framework? hmm. I know how to create a framework but compiling as a dylib hadn't worked yet. :-( Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
yeap, okay, its just the beginning so I didn't know that the framework is still the dylib file. Well, I only want to compile python and put the framework in the subdirectory. Thats all. And the current state is, that the framework is not found because the path of the compiled Python library is hardcoded so when I move it from /Library/Frameworks/ to my app folder it isn't found when I start my app. I found a ressource that I have to compile it with a dynamic path flag like LDFLAGS="-install_name,@executable_path/../Frameworks" to put it in the Framework of my app. maybe you know where my problem is. hm. bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6.1 @executable_path
Hi! Woow, thanks. The unix command install_name_tool solved my problem. Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
MaxInt on Vista-64bit?
Hi! I downloaded Python64 for Windows Vista64 but the value returned from sys.maxint is just a 32bit integer. I found out, thats by design, Microsoft decided to make the long value 32bit. What can I do to compile python 2.6 with maxint of 64bit integers? Can I replace the int values to a int64 value? Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list
Re: MaxInt on Vista-64bit?
Hi! Thanks for the fast answer. Yes, its enough but I never thought that Vista64 is not a real 64-bit operating system :-o. -- http://mail.python.org/mailman/listinfo/python-list
Python C API (PyObject_CallMethod clear object)
Hi! I have a problm with deallocating stuff. I call a function with this command: PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); if(rvalue==NULL) PyErr_Print(); else Py_DECREF(rvalue); Can it be, that something is missing here? Imagine I allocate an object of a type: t = MyImage() ,;- syntax_error 129=)/% #is a syntax error How you see I would get a syntaxerror, but an object of the type MyImage() is created. But its deallocated when Py_Finalize() is called. What can I do to deallocate this object after PyObject_CallMethod returns NULL, too? I debug it, so if rvalue!=NULL the object is deallocated, but what can I do if rvalue==NULL= Thanks a lot -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C API (PyObject_CallMethod clear object)
On 26 Jan., 03:25, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:46:01 -0200, > escribió: > > > > > I have a problm with deallocating stuff. I call a function with this > > command: > > > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); > > > if(rvalue==NULL) > > PyErr_Print(); > > else > > Py_DECREF(rvalue); > > > Can it be, that something is missing here? Imagine I allocate an > > object of a type: > > > t = MyImage() > > ,;- syntax_error 129=)/% #is a syntax error > > > How you see I would get a syntaxerror, but an object of the type > > MyImage() is created. But its deallocated when Py_Finalize() is > > called. What can I do to deallocate this object after > > PyObject_CallMethod returns NULL, too? I debug it, so if rvalue!=NULL > > the object is deallocated, but what can I do if rvalue==NULL= > > A syntax error is detected *before* the code runs -- so the object isn't > created at all. > > -- > Gabriel Genellina Hi! Yes, you are right. I got this issue not in syntax error, I get it on a runtime error like this: t = MyImage() self.test("hallo") #test takes an integer so this would throw an exception. Here you see, an object of the type MyImage() was created but its not deleted. 't' is a local reference so how can I do that? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C API (PyObject_CallMethod clear object)
the hook is, how to delete the locals of this function, maybe thats a workaround? thanks and bye. -- http://mail.python.org/mailman/listinfo/python-list
ImportError in embedded Python Interpreter
Hi, i have a problem. I compiled Python and the socket module so I got this structure. (all on windows) C:\test\dll_files\python25.dll C:\test\my_app C:\test\dll_files\DLLs\ C:\test\dll_files\python.exe If I run python I get the console and I can call "import socket" which succeeds. I wrote a small console app which is stored in C:\test\ and embeddeds the python interpreter. I set the environment variable PATH so the python DLL files can be load. But when I want to import in a script the socket module, it fails. (The interpreter works fine, just importing files in the DLLs folder fail). Why? When I print out the sys.path I get the same like in the real python.exe. What do you think, whats missing? Thanks a lot. bye :) -- http://mail.python.org/mailman/listinfo/python-list
ImportError in embedded Python Interpreter
Hi, i have a problem. I compiled Python and the socket module so I got this structure. (all on windows) C:\test\dll_files\python25.dll C:\test\my_app C:\test\dll_files\DLLs\ C:\test\dll_files\python.exe If I run python.exe I get the console and I can call "import socket" which succeeds. I wrote a small console app which is stored in C:\test\ and embeddeds the python interpreter. I set the environment variable PATH so the python25.dll can be load. But when I want to import the socket module in a script, it fails. (The interpreter works fine, just importing files in the DLLs folder fail). Why? When I print out the sys.path in my app I get the same like in the real python.exe. What do you think, whats missing? Thanks a lot. bye :) -- http://mail.python.org/mailman/listinfo/python-list
Re: ImportError in embedded Python Interpreter
Hi! Okay, I checkede Py_Main(...) and called some python code there. There it works too. So I know whats missing. sys.environ.. returns nothing. How can I set the paths with the Python C API? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: ImportError in embedded Python Interpreter
Hi! Thanks. Well, os.py is found and all the others which don't need a library. I tested this: I execute Py_Main(...) in my app which executes the console interpreter and i tried to execute "import socket" which works. So Py_Main has something what my created PyRun_SimpleString doesn't have. Maybe the environment variables? Something has to be called in Py_Main which I should call, too. bye.. -- http://mail.python.org/mailman/listinfo/python-list
Re: ImportError in embedded Python Interpreter
Hi! Okay, thats just the question. I did that what you wrote but it doesn't really works. What is, if Py_SetProgramName() gets a NULL Pointer, if argv[0] is empty? Well, the problem is, in my opinion that os.environ returns some paths in python.exe and in my embedded interpreter if I call os.environ in Py_Main(...) When I call it in my PyRun_SimpleString(...) it returns nothing. Hm.. thats really strange. -- http://mail.python.org/mailman/listinfo/python-list
Python C API
Hi :) I have a main() function of my app which intializes the Python Interpreter and some other stuff. When I am finished I call: PyGILState state = PyGILState_Ensure() //call PyRun_String() PyGILStateRelease(state); The first question is, I found out the API contains other commands lik PyEval_AcquireLock(). I don't really understand if I have to use them too, could anyone explain? Thanks. Okay, back to topic. In PyRun_String() I call a wrapped function. This wrapped function does some internal calculations and takes a pointer to another function which is called in another thread while it calculates the stuff. void MyProgressbar(Real p, void* hook) // this function wil be called in another thread { PyGILState_STATE gilstate = PyGILState_Ensure(); PyObject* func = (PyObject*)hook; //do some python stuff PyGILState_Release(gilstate) } PyObject *pyMyFunction(PyObject *pSelf, PyObject *args, PyObject *keywords) { static char *kwlist[] = {"hook", NULL}; PyObject *hook=NULL; if (!PyArg_ParseTupleAndKeywords(args, keywords, "O!", kwlist, &PyFunction_Type, &hook)) return NULL; LONG ok = MyFunction(myprogress, hook); //hook is a pointer which is passed to the threaded function. Py_RETURN_INT(ok); } I want to do the same in Python. I want to pass a reference of a function to the function which is called from the other thread. But it stops (not crash) here: PyGILState_STATE gilstate = PyGILState_Ensure (); What can I do? Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C API
Hi! thats a very interesting point and good to know. I have to release the GIL but how do I do? In this case i need PyEval_AcquireLock and PyEval_ReleaseLock? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C API
Hi! Any ideas? Thanks, :) -- http://mail.python.org/mailman/listinfo/python-list
Python with PyGIL_Ensure?
Hi! I have a small problem with my python embedded interpreter. I do some stuff where two threads exists which do some pythons stuff in the same stuff. So bpoth call PyGILState_Ensure() which occurs a crash. What can I do, that one thread waits until the other thread released the gil state? Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python with PyGIL_Ensure?
and merry christmas :) -- http://mail.python.org/mailman/listinfo/python-list
Compile as static library
Hi! I have a big problem with compiling Python on MacOSX. I compile it - everything works ./configure make so I get a libpython2.5.a file which I include into a Xcode Project. I want to static link it with my project (works in Debug mode but not in Release) 1. Is there a static library flag which I have to set, or something like that? 2. Why does it work in Debug mode, not in Release? The import settings for a library doesn't differe between debug and release, does it? Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
Python 2.6 fails on compiling > Bug report
Hi! I compiled Python 2.6.1 on a Mac OSX 10.5.5 Intel machine with this configure command and got this message FAILS: ./configure --with-framework-name=Python --with- universal-archs=all --enable-framework --enable- universals...@executable_path/my/path/to/app WORKS: ./configure --with-framework-name=Python --with- universal-archs=all --enable-framework --enable-universalsdk=/ [...] configure: WARNING: dlfcn.h: present but cannot be compiled configure: WARNING: dlfcn.h: check for missing prerequisite headers? configure: WARNING: dlfcn.h: see the Autoconf documentation configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled" configure: WARNING: dlfcn.h: proceeding with the preprocessor's result configure: WARNING: dlfcn.h: in the future, the compiler will take precedence configure: WARNING: ## ## configure: WARNING: ## Report this to http://www.python.org/python-bugs ## configure: WARNING: ## ## checking for dlfcn.h... yes [...] many of this error warnings occure. /* its already noted in the bug reporter but there is no solution. Does anyone know how to use my custom path? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6 fails on compiling > Bug report
Hi searched for "Library/Frameworks/" in the config file and edited it to "@executable_path". Well my configure and make command worked very fine. Just 'make install' aborted after this error message. test -d "/Applications/Python 2.6" || mkdir -p "/Applications/Python 2.6" test -d "/Applications/Python 2.6/IDLE.app" && rm -r "/Applications/ Python 2.6/IDLE.app" cp -PR IDLE.app "/Applications/Python 2.6" touch "/Applications/Python 2.6/IDLE.app" cp ./config-main.def "@executable_path/Python.framework/Versions/2.6/ lib/python2.6/idlelib/config-main.def" cp: @executable_path/Python.framework/Versions/2.6/lib/python2.6/ idlelib/config-main.def: No such file or directory make[2]: *** [install] Error 1 make[1]: *** [install_IDLE] Error 2 make: *** [frameworkinstallapps4way] Error 2 That is not cool.. really.. thats not cool. Thanks for your tipps. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6 fails on compiling > Bug report
hm... any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.6 fails on compiling > Bug report
Hi! I didn't wanted to post 11.000 Lines here, so I uploaded it here: http://rapidshare.com/files/181425216/config.log.html -- http://mail.python.org/mailman/listinfo/python-list
PyEval_EvalCode(...) problem
Hi! I have a problem with PyEval_EvalCode(...) I compile the following code and execute them with PyEval_EvalCode (...) class MyClass(mod.Upper): pass register(MyClass) #just the type, not the instance Thats all. So register(...) is a Python C API method so i take the type and store it in a global variable. PyEval_EvalCode(...) returns not NULL and I do not decref the dictionary, just the returnvalue. After PyEval_EvalCode(..) is executed I would like to create an instance of MyClass which crashes because information of the inherited types are corrupt. If I call PyObject_CallObject(obj, NULL) in register(..) where PyEval_EvalCode (..) is still active everything works fine but when I call it after PyEval_EvalCode, even I did not decref anything) its not working. Can anyone of you help me? The refcounts of the MyClass type are > 0. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyEval_EvalCode(...) problem
http://rafb.net/p/Uyb5Ps45.html Pelase note, when I call PyObject_CallObject(...) in the wrapped C register(..) method it works fine. -- http://mail.python.org/mailman/listinfo/python-list
Interrupt Python C API
Hi, I just have a design problem and don't know how to solve it. I call a function which executes a simple "PyRun_String(...)" command. imagine the script while 1: pass is executed so the app would hang. Is there any chance to break out this PyRun_String-function? I just searched the forums for that stuff but these information are very rare. Thanks for any suggestions. Bye. -- http://mail.python.org/mailman/listinfo/python-list
Re: Interrupt Python C API
hi, yes, thats true, Alan Touring told us, so it would be nice to let the user abort it. Is there a chance for windows, too? -- http://mail.python.org/mailman/listinfo/python-list
Re: Interrupt Python C API
On 16 Apr., 11:08, Piet van Oostrum wrote: > > googler.1.webmas...@spamgourmet.com (g1w) wrote: > >g1w> hi, yes, thats true, Alan Touring told us, so it would be nice to let > >g1w> the user abort it. > >g1w> Is there a chance for windows, too? > > I don't know. I have no access to Python on Windows. Maybe there is > setitimer support on Windows. Or maybe you can use the threading.Timer > object, like this: > > import signal, os > import threading > > signalcode = signal.SIGALRM # on Windows, choose one that exists there. > > class AlarmError(Exception): > pass > > def interrupt(): > os.kill(os.getpid(), signalcode) > > def execute(command, timeout): > threading.Timer(timeout, interrupt).start() > try: > exec(command) > except AlarmError, e: > print e > print 'Aborted "%s"' % (command,) > print "continue work" > > print "The everlasting command" > execute("while 1: pass", 10) > print "The End" > > -- > Piet van Oostrum > URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4] > Private email: p...@vanoostrum.org thx, i will check... :) merci -- http://mail.python.org/mailman/listinfo/python-list
Threading and GIL
Hi! I have a big problem I can't solve and I hope anyone of you can help me. I use the Python C API and in C++ I have a class which represets a thread object, similiar to the thread class of the known Python Thread class but with some needed additions so thats the reason why I have to built my own. Well, this is the problem. There is a method called Thread::End() which I can call in Python. But now the End() Function waits until the "Main" Function of my C++ class is done, but in this method I want to ensure the Global Interpreter Lock but this is already locked by the Thread which executes the End() command. So both is waiting and stops. The thread which calls the End () method is waiting for the finish of the Main() method of the Thread Class and the Main-Method in the other thread waits for the thread of the End() command that this is done - welcome Deadlock. Any suggestions what I have to do? Thank you veeery much for you help, otherwise I become really crazy here because this is the first time I have such a problem. Bye :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading and GIL
Hi, thats the reason why its not working. Imagine the end() method of the thread object is called so the C++ Function is opened where the code for this method is in. At a line the Code ...->End() is called which waits that the C++ Thread class is finished. BUT here is the problem: In the Method of the C++ class which is in threaded mode can't run because its still waiting that the GIL is released by the thread which executed the ->End() command. So the app has a deadlock when it arrives at ->End() and PyGILState_Ensure function. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading and GIL
hey, thanks, that works fine. I wrapped it around, done a lot of tests and it works fine. Just had done a few other things to make it stable. cheers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Embedding Thread
Does anyone has a tip? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Embedding Thread
Hi! Thank you very much for your answers. I have a menue with a script in it. So my app starts a new thread for each script. So I would like to run two scripts all the same time. Could someone give me a tip, what I have to set in my code? Thank you :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Embedding Thread
Hi! I fixed the code. This code snippet runs in a seperate thread: PyObject *dict=NULL; PyGILState_STATE state = PyGILState_Ensure(); dict = CreateMyGlobalDictionary(); PyRun_String(, Py_file_input, dict, dict); ReleaseGlobalDictionary(dict); But it still does not work... :-/ -- http://mail.python.org/mailman/listinfo/python-list
PyMarshal Commands crash on Windows
Hi! Can anyone help me with this issue? int main (int argc, char * const argv[]) { Py_Initialize(); FILE* fp = fopen("/Users/test/Desktop/123.pyc","wb"); PyCodeObject* op = (PyCodeObject*)Py_CompileString("import sys \nprint 'hello'","",Py_file_input); PyMarshal_WriteObjectToFile((PyObject *)op, fp, Py_MARSHAL_VERSION); Py_Finalize(); return 0; } This Code crashs on Windows, and I can't explain why. I want to convert a PyCodeObject to a PyObject and save it to the harddisk. PyMarshal_ReadObjectFromFile(FILE *P) crashs too if I want to read a byte-compiled object. Thank your for your help. donnerChecker -- http://mail.python.org/mailman/listinfo/python-list
Re: PyMarshal Commands crash on Windows
Hi! Please remember, that the script crashs on Line PyMarshal_WriteObjectToFile. :-( -- http://mail.python.org/mailman/listinfo/python-list
Re: PyMarshal Commands crash on Windows
Hi! I shortened the quode. Everything should be all right and nothing is a NULL Pointer. What about PyMarshal_ReadObjectFromFile(FILE* p), this crashs too :-/ hm... the problem is, on mac everything is all right.. thanks... -- http://mail.python.org/mailman/listinfo/python-list
Last mod date
This is my first post--I'm a Java developer trying to expand my horizons. I'm trying to figure out how to find out the last modification date/time for a file. I've found a reference to *PyOS_GetLastModificationTime *as an Operating System Utility, but I can't figure out which module I need to import to access it. I'm using Python version 2.4.1 on a box running Windows (it works, and nobody else in the house wants to use it). Thanks in advance, Mike -- http://mail.python.org/mailman/listinfo/python-list