Re: Why does my compiler say invalid syntax then highlight...?
I may have your problem: if prime < 0: primes.append(x) else: print x, "is not prime. " # highlights the final " you have to separate each output with a comma, so try adding one after x. -- http://mail.python.org/mailman/listinfo/python-list
Re: Open a file with default handler app?
On Mar 11, 9:24 pm, [EMAIL PROTECTED] wrote: > Hi, I searched for this on google and in this group, but my awesome > google-fu powers failed me. Is there a way to open any file using > default program that'd open it? In other words, to do the same action > as double-clicking in windows explorer? And secondly, is there a way > to do the same thing for linux that'd work across all desktop > environments and distributions, or at least in all major ones? What > I'm trying to do here is to have records (or items) in my app where > you could attach any kind of file and open it from there by clicking > 'open'. Then it would go and do something like os.system("launch %s" % > filename). So any way to do this except for keeping your own > dictionary of file types and relevant apps? thx, -ak Hey there, I've had to do the same things for a program that I'm writing. The following command should do the trick: os.startfile("yourfilehere") from the os module. Hope this helps! -- http://mail.python.org/mailman/listinfo/python-list
Re: Are .pyc files portable?
Python compiles to bytecode, which means that pyc files can be interpreted by any Python executable regardless of platform. As for manual compilation to directories, the py_compile module is the one you want. Here's an example program to plug in. #test_compile.py# import py_compile print "hello" py_compile.compile("test_compile.py", "C:\test_compile.pyc") The manual page for py_compile.compile() can be found on this page: http://www.python.org/doc/2.5.2/lib/module-pycompile.html Hope that helps. Cheers, Wubbulous -- http://mail.python.org/mailman/listinfo/python-list
Re: Are .pyc files portable?
Yes, apologies, I overlooked that detail. If using a different version of the binary, (i.e. 3.0 vs 2.6) you will have to re-compile the source code. -- http://mail.python.org/mailman/listinfo/python-list