PIL build error on Snow Leopard
Hello, I haven't fully understood the nuances in the difference between Apple's system Python and MacPython. But I have just installed Python 2.6.4 from python.org. Now I'm trying to install a fresh downloaded PIL 1.1.6 but couldn't. python setup.py install gives: lipo: can't open input file: /var/tmp//ccfwpQd6.out (No such file or directory) Everything worked fine on Apple's Python 2.6.1 -- http://mail.python.org/mailman/listinfo/python-list
python call golang
Hey ! Now! I have written a python script . I want to call a golang script in python script. Who can give me some advices? thanks! -- http://mail.python.org/mailman/listinfo/python-list
About GIL Questions!
Hey everyone! Recently I see the python source code, but i still not understand about gil. first, why single core quicker multi-core ? who can explan this in bottom layery ? second, what the different between the mult-core and the single core to schecule threads? thanks! Forgive me bad english! -- http://mail.python.org/mailman/listinfo/python-list
Hello Everyone! A simple questions!
>>> values = [0, 1, 2]>>> values[1] = values>>> values[0, [...], 2] why?? -- http://mail.python.org/mailman/listinfo/python-list
Re: Hello Everyone! A simple questions!
Thanks I just surprised by three dot 2013/7/26 Florian Baumgartner > As alex23 already indicated you created a recursive data-structure (by > inserting a reference to the list into the second place of the list) and > the interpreter handles this gracefully by showing [...]. > > In case you really want to insert the lists members into the second place > you can assign a copy of the list. > > values = [0,1,2] > values[1] = values[:] > > > > > > 2013/7/26 Thanatos xiao > >> >>> values = [0, 1, 2]>>> values[1] = values>>> values[0, [...], 2] >> >> why?? >> >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> >> > -- http://mail.python.org/mailman/listinfo/python-list
Qtcore error problem
Dear python users, I am new to python and now I met a problem. When I try to run a py file, I got the following error: from vacumm.misc.grid.regridding import regrid2d File "/home/xzhang3/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/vacumm/misc/__init__.py", line 41, in import color File "/home/xzhang3/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/vacumm/misc/color.py", line 50, in import pylab as P ImportError: /home/xzhang3/usr/local/uvcdat/2.4.1/lib/python2.7/site-packages/PyQt4/QtCore.so: undefined symbol: _ZN7QLocale14scriptToStringENS_6ScriptE I searched the web and it looks like the problem has something to do with different versions. Any idea how to fix the problem ? I am using python 2.7 now. Really appreciate your ideas and best regards, Xiao -- https://mail.python.org/mailman/listinfo/python-list
Hot to split string literals that will across two or more lines ?
Hi, I need to print a long sting, which is two long so it must expand two lines. I know that we can use backslash(\) to explicitly join two lines into a logical line, but this doesn't work for string literals :( my code: - if sth.: print "a string whcih is very very looo\ ng." - If I don't break the line, it will be very ugly, if I break the line,but how ? Thanks in advance! xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Re: Hot to split string literals that will across two or more lines ?
[EMAIL PROTECTED] wrote: >Xiao Jianfeng wrote: > > >>Hi, >> >>I need to print a long sting, which is two long so it must expand two >>lines. >>I know that we can use backslash(\) to explicitly join two lines into a >>logical line, >>but this doesn't work for string literals :( >> >>my code: >>- >>if sth.: >>print "a string whcih is very very looo\ >>ng." >>- >> >>If I don't break the line, it will be very ugly, if I break the >>line,but how ? >> >>Thanks in advance! >> >> >in python there are triple quoted strings: >strVar = """this the beginning >and this is the end """ > > Thanks. But even I use triple quoted strings instead , there is still extra space before "and this...". The string I want to print is in a "if" statement, so it is not at the beginning of the line. >>xiaojf >> >> > > > -- http://mail.python.org/mailman/listinfo/python-list
Re: Hot to split string literals that will across two or more lines ?
Lars Kellogg-Stedman wrote: >>print "a string whcih is very very looo\ >>ng." >> >> > >print "a string which is very loo" \ > + "ong." > >-- Lars > > > Oh, Thank you! -- http://mail.python.org/mailman/listinfo/python-list
Re: install python2.4 on FreeBSD and keep using python2.3
Andrew MacIntyre wrote: >[posted & mailed] >Ksenia Marasanova wrote: > > > >>I have python2.3, installed from port /lang/python long time ago. The >>current version is 2.4, but I'd rather have two python versions, >>instead of upgrading. >>Is there maybe a way to somehow link installed python to >>/lang/python2.3 port, and then upgrade ports and install /lang/python >>as a new (2.4) version, without upgrading? >>Or am I missing something and the things are much easier? I am not a >>FreeBSD guru and it's my first python upgrade... thanks! >> >> > >As far as I know, the FreeBSD ports versions of python don't interfere >with python's default strategy of installing based on major.minor version >numbers (eg /usr/local/lib/python2.[3|4] & /usr/local/bin/python2.[3|4]). >/usr/local/bin/python will be linked to the most recently installed >python port. > > > Can I install python2.4.2 and keep using python2.4.1 on IRIX? >Its been a while since I looked, but I thought that the ports collection >would contain 2.3(.5) as well as 2.4(.2, default "python" port), so I >expect that the ports collection has support for multiple versions >anyway. > >So you should be able to update the ports collection, change into >lang/python and "make install". A quick review of the port makefiles >should confirm this. Any scripts that are 2.3 only will need to be >doctored to use /usr/local/bin/python2.3 instead of >/usr/local/bin/python. > >- >Andrew I MacIntyre "These thoughts are mine alone..." >E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370 >[EMAIL PROTECTED] (alt) |Belconnen ACT 2616 >Web:http://www.andymac.org/ |Australia > > -- http://mail.python.org/mailman/listinfo/python-list
Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
[EMAIL PROTECTED] wrote: >newer python should use "for x in fh:", according to the doc : > >fh = open("your file") >for x in fh: print x > >which would only read one line at a time. > > > I have some other questions: when "fh" will be closed? And what shoud I do if I want to explicitly close the file immediately after reading all data I want? >Ross Reyes wrote: > > >>HI - >>Sorry for maybe a too simple a question but I googled and also checked my >>reference O'Reilly Learning Python >>book and I did not find a satisfactory answer. >> >>When I use readlines, what happens if the number of lines is huge?I have >>a very big file (4GB) I want to >>read in, but I'm sure there must be some limitation to readlines and I'd >>like to know how it is handled by python. >>I am using it like this: >>slines = infile.readlines() # reads all lines into a list of strings called >>"slines" >> >>Thanks for anyone who knows the answer to this one. >> >> > > > -- http://mail.python.org/mailman/listinfo/python-list
Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
Steven D'Aprano wrote: >On Sun, 20 Nov 2005 11:05:53 +0800, Xiao Jianfeng wrote: > > > >> I have some other questions: >> >> when "fh" will be closed? >> >> > >When all references to the file are no longer in scope: > >def handle_file(name): >fp = file(name, "r") ># reference to file now in scope >do_stuff(fp) >return fp > > >f = handle_file("myfile.txt) ># reference to file is now in scope >f = None ># reference to file is no longer in scope > >At this point, Python *may* close the file. CPython currently closes the >file as soon as all references are out of scope. JPython does not -- it >will close the file eventually, but you can't guarantee when. > > > >> And what shoud I do if I want to explicitly close the file immediately >>after reading all data I want? >> >> > >That is the best practice. > >f.close() > > > > Let me introduce my problem I came across last night first. I need to read a file(which may be small or very big) and to check line by line to find a specific token, then the data on the next line will be what I want. If I use readlines(), it will be a problem when the file is too big. If I use "for line in OPENED_FILE:" to read one line each time, how can I get the next line when I find the specific token? And I think reading one line each time is less efficient, am I right? Regards, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
Steve Holden wrote: >Xiao Jianfeng wrote: > > >>Steven D'Aprano wrote: >> >> >> >> >>>On Sun, 20 Nov 2005 11:05:53 +0800, Xiao Jianfeng wrote: >>> >>> >>> >>> >>> >>> >>>>I have some other questions: >>>> >>>>when "fh" will be closed? >>>> >>>> >>>> >>>> >>>When all references to the file are no longer in scope: >>> >>>def handle_file(name): >>> fp = file(name, "r") >>> # reference to file now in scope >>> do_stuff(fp) >>> return fp >>> >>> >>>f = handle_file("myfile.txt) >>># reference to file is now in scope >>>f = None >>># reference to file is no longer in scope >>> >>>At this point, Python *may* close the file. CPython currently closes the >>>file as soon as all references are out of scope. JPython does not -- it >>>will close the file eventually, but you can't guarantee when. >>> >>> >>> >>> >>> >>> >>>>And what shoud I do if I want to explicitly close the file immediately >>>>after reading all data I want? >>>> >>>> >>>> >>>> >>>That is the best practice. >>> >>>f.close() >>> >>> >>> >>> >>> >>> >> Let me introduce my problem I came across last night first. >> >> I need to read a file(which may be small or very big) and to check line >>by line >> to find a specific token, then the data on the next line will be what I >>want. >> >> If I use readlines(), it will be a problem when the file is too big. >> >> If I use "for line in OPENED_FILE:" to read one line each time, how can >>I get >> the next line when I find the specific token? >> And I think reading one line each time is less efficient, am I right? >> >> >> >Not necessarily. Try this: > > f = file("filename.txt") > for line in f: > if token in line: # or whatever you need to identify it > break > else: > sys.exit("File does not contain token") > line = f.next() > >Then line will be the one you want. Since this will use code written in >C to do the processing you will probably be pleasantly surprised by its >speed. Only if this isn't fast enough should you consider anything more >complicated. > >Premature optimizations can waste huge amounts of unnecessary >programming time. Don't do it. First try measuring a solution that works! > > Oh yes, thanks. >regards > Steve > > First, I must say thanks to all of you. And I'm really sorry that I didn't describe my problem clearly. There are many tokens in the file, every time I find a token, I have to get the data on the next line and do some operation with it. It should be easy for me to find just one token using the above method, but there are more than one. My method was: f_in = open('input_file', 'r') data_all = f_in.readlines() f_in.close() for i in range(len(data_all)): line = data[i] if token in line: # do something with data[i + 1] Since my method needs to read all the file into memeory, I think it may be not efficient when processing very big file. I really appreciate all suggestions! Thanks again. Regrads, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
[EMAIL PROTECTED] wrote: >Xiao Jianfeng wrote: > > >> First, I must say thanks to all of you. And I'm really sorry that I >>didn't >> describe my problem clearly. >> >> There are many tokens in the file, every time I find a token, I have >>to get >> the data on the next line and do some operation with it. It should be easy >> for me to find just one token using the above method, but there are >>more than >> one. >> >> My method was: >> >> f_in = open('input_file', 'r') >> data_all = f_in.readlines() >> f_in.close() >> >> for i in range(len(data_all)): >> line = data[i] >> if token in line: >> # do something with data[i + 1] >> >> Since my method needs to read all the file into memeory, I think it >>may be not >> efficient when processing very big file. >> >> I really appreciate all suggestions! Thanks again. >> >> >> >something like this : > >for x in fh: > if not has_token(x): continue > else: process(fh.next()) > >you can also create an iterator by iter(fh), but I don't think that is >necessary > >using the "side effect" to your advantage. I was bite before for the >iterator's side effect but for your particular apps, it becomes an >advantage. > > Thanks all of you! I have compared the two methods, (1). "for x in fh:" (2). read all the file into memory firstly. I have tested the two methods on two files, one is 80M and the second one is 815M. The first method gained a speedup of about 40% for the first file, and a speedup of about 25% for the second file. Sorry for my bad English, and I hope I haven't made people confused. Regards, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
[EMAIL PROTECTED] wrote: >Xiao Jianfeng wrote: > > >> I have compared the two methods, >> (1). "for x in fh:" >> (2). read all the file into memory firstly. >> >> I have tested the two methods on two files, one is 80M and the second >>one is 815M. >> The first method gained a speedup of about 40% for the first file, and >>a speedup >> of about 25% for the second file. >> >> Sorry for my bad English, and I hope I haven't made people confused. >> >> > >So is the problem solved ? > > Yes, thank you. >Putting buffering implementation aside, (1) is the way to go as it runs >through content only once. > > > I think so :-) Regards, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
How to install python2.4.2 on IRIX6.5 ?
Hello, I am trying to install python2.4.2 on a SGI origin3200 machine running IRIX6.5. The native c compiler was used to compile python. "./configure --prefix=/my/path/to/install" runs ok, then, "smake OPT= " runs ok but "smake test" gets errors, here is the output: 247 tests OK. 2 tests failed: test_fpformat test_locale 41 tests skipped: test_aepack test_al test_applesingle test_bsddb test_bsddb185 test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_dl test_gdbm test_gl test_gzip test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_nis test_normalization test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socket_ssl test_socketserver test_sunaudiodev test_tcl test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_zipimport test_zlib Ask someone to teach regrtest.py about which tests are expected to get skipped on irix6. *** Error code 1 smake: Error: 1 error I also tried regrtest.py according the above instruction, origin3200% ./Lib/test/regrtest.py -s test_fpformat test_fpformat test test_fpformat failed -- Traceback (most recent call last): File "/disk2/jfxiao/local/source/Python-2.4.2/Lib/test/test_fpformat.py", line 51, in test_reasonable_values self.checkFix(realVal, d) File "/disk2/jfxiao/local/source/Python-2.4.2/Lib/test/test_fpformat.py", line 28, in checkFix self.assertEquals(result, expected) AssertionError: '-0' != '0' 1 test failed: test_fpformat origin3200% ./Lib/test/regrtest.py -s test_locale test_frozen 1 test OK. - Can somebody tell me what's the problem ? Thanks! Regards, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
python2.4.2 test_fpformat and test_locale failed on IRIX6.5
Hello, I am trying to install python2.4.2 on IRIX6.5, but test_fpformat and test_locale failed when I ran "smake test". The following is the detailed error message: prompt:\> ./python ./Lib/test/test_fpformat.py test_basic_cases (__main__.FpformatTest) ... ok test_failing_values (__main__.FpformatTest) ... ok test_reasonable_values (__main__.FpformatTest) ... FAIL == FAIL: test_reasonable_values (__main__.FpformatTest) -- Traceback (most recent call last): File "./Lib/test/test_fpformat.py", line 51, in test_reasonable_values self.checkFix(realVal, d) File "./Lib/test/test_fpformat.py", line 28, in checkFix self.assertEquals(result, expected) AssertionError: '-0' != '0' -- Ran 3 tests in 0.005s FAILED (failures=1) Traceback (most recent call last): File "./Lib/test/test_fpformat.py", line 75, in ? test_main() File "./Lib/test/test_fpformat.py", line 71, in test_main run_unittest(FpformatTest) File "/user_data2/jfxiao/local/source/python/python-2.4.2/Python-2.4.2/Lib/test/test_support.py", line 290, in run_unittest run_suite(suite, testclass) File "/user_data2/jfxiao/local/source/python/python-2.4.2/Python-2.4.2/Lib/test/test_support.py", line 275, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "./Lib/test/test_fpformat.py", line 51, in test_reasonable_values self.checkFix(realVal, d) File "./Lib/test/test_fpformat.py", line 28, in checkFix self.assertEquals(result, expected) AssertionError: '-0' != '0' prompt:\> ./python ./Lib/test/test_locale.py '%f' % 1024 =? '1,024.00' ... no '%f' % 1024 == '1024.00' != '1,024.00' '%f' % 102 =? '102.00' ... yes '%f' % -42 =? '-42.00' ... yes '%+f' % -42 =? '-42.00' ... yes '%20.f' % -42 =? ' -42' ... yes '%+10.f' % -4200 =? ' -4,200' ... no '%+10.f' % -4200 == ' -4200' != ' -4,200' '%-10.f' % 4200 =? '4,200 ' ... no '%-10.f' % 4200 == '4200 ' != '4,200 ' Can someone tell me how to fix this ? Thanks in advance. Regrads, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Has this problem been fiexed ?
Hello, I'm trying to build python2.4.2 on IRIX6.5(cc version MIPSpro Compilers: Version 7.3.1.3m). But the socket module failed to compile. I found this in ./Modules/socketmodule.c, line 193: /* XXX Using _SGIAPI is the wrong thing, 194 but I don't know what the right thing is. */ 195 #undef _SGIAPI /* to avoid warning */ 196 #define _SGIAPI 1 I think maybe somebody have already fixed this problem. Or any hints on how to compile socket module on IRIX? Thanks very much. Regards, xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Are there free molecular libraries written in python ?
Hi, Are there any free libraries for the analysis and manipulation of molecular structural models, implemented in the Python programming language ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: add sys to __builtins__
Paul Watson wrote: >This sounds pretty interesting. How about a switch to invoke this >handling for the one-liner crowd and those who wish to use it? > > > >Somehow, I never heard any C programmers suggest that the default >processing not include the need for: > >#include > > I think it is because that we cannot modify the C language, but python is a language that's still evolving. -- http://mail.python.org/mailman/listinfo/python-list
about pyyaml questions!
Hi Guys: Now I use pyyaml to load a yaml file, after I dump this load data,but I found an questions,before I load the yaml file,the file looks like: - -b -c - -e -x after I dump this data and write file, the file looks like: - -b -c - -e -x although when dump file, I have set default_flow_style=False Can the dumped file the same as original file? ths. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] Released: Python 2.6.9 release candidate 1
Ooh!ths! 2013/10/1 Barry Warsaw > Hello Pythoneers and Pythonistas, > > I'm happy to announce the availability of Python 2.6.9 release candidate 1. > > Python 2.6.9rc1 is a security-fix source-only release for Python 2.6. This > means that general bug maintenance has ended, and only critical security > issues are being fixed. It also means that no installers for Windows or > Mac > OS X will be provided. The last binary release of Python 2.6 was 2.6.6. > > Python 2.6.9 final is currently scheduled for Monday, October 28, 2013. > Five > years after the original release of Python 2.6, the 2.6.9 final release > will > be the last release of the Python 2.6 series. After this, all official > maintenance of any kind for Python 2.6 will cease and the series will be > retired. > > For ongoing maintenance, please see Python 2.7. > > Since 2.6.9 will be the last Python 2.6 release ever, I ask that you please > download Python 2.6.9rc1, build it on your favorite platforms, and test it > with your favorite code. You can report bugs to the Python bug tracker: > > http://bugs.python.org > > The source can be download from: > > http://www.python.org/download/releases/2.6.9/ > > You can also see what's changed since Python 2.6.8: > > http://www.python.org/download/releases/2.6.9/NEWS.txt > > Many thanks go out to the entire Python community for their contributions > and > help in making Python 2.6.9 available, especially Jyrki Pulliainen for his > patch contributions. > > Enjoy, > -Barry > (on behalf of the Python development community) > > ___ > Python-Dev mailing list > python-...@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/yanxiaopei199%40gmail.com > > -- https://mail.python.org/mailman/listinfo/python-list
HELP! about long polling!!!
Hi all: Now I develop an ios app, which need use long polling. when server have data, the server push data to ios app. I use django to backend, Can give me some advice or example ? ths -- https://mail.python.org/mailman/listinfo/python-list
The difference between "import package.module" and "from package import module"(about pymol)
Hello, In pymol I can use "from chempy import Atom" but "import chempy.Atom" doesn't work. It says,"ImportError: No module named Atom". What is going wrong ? Thanks -- http://mail.python.org/mailman/listinfo/python-list
genetic algorithms package for python ?
Hi all, I am looking for a genetic algorithms package for Python. I have googled the web before posting and found some links. The link of pygene(http://www.freenet.org.nz/python/pygene) cannot be opened. I also tried the recipe on ASPN, but it is too simple for my application, and the ga model in SciPy, which is in testing in the "sandbox". Are there any more genetic algorithms packages for Python ? Thanks a lot! xiaojf -- http://mail.python.org/mailman/listinfo/python-list
Please recommend library for multithread download
Hello there, I am looking for library (small better) that can fetch URL and download to local file in multi-threads. urllib2 is not thread safe as I tested. What will be? -- http://mail.python.org/mailman/listinfo/python-list
How can I do this with python ?
Dear all, In a shell script, I can run a command which need interactive input like this, #!/bin/sh A_Command<<-EOF a b c EOF But, how can I do this with python ? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I do this with python ?
Tim N. van der Leeuw wrote: > Your question is insufficiently clear for me to answer. > > Do you want to know how to read from standard-input in a Python > program? > > Do you want to know how to start an external program from Python, and > then connect something to that programs standard input? > > Do you want to know something else? > > Please specify! > > Cheers, > > --Tim > > Thanks. For example, I can call vim and do something like this in a shell script, #!/bin/sh vim a.file<<-EOF :some_vim_command :some_vim_command :w :q EOF I want to know how to call vim and to the same thing with python. Regrads, -- http://mail.python.org/mailman/listinfo/python-list
Still wrong architecture on Snow Leopard
Hi everyone, I have Snow Leopard and followed 4.6.1 snapshot 20091010's reference 3.4 instructions to configure both SIP and PyQt in i386. Everything installed fine but when I open Python and tried to import ImageQt, I get the following error: Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/PIL/ImageQt.py", line 20, in from PyQt4.QtGui import QImage, qRgb ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtGui.so, 2): no suitable image found. Did find: /Library/Python/2.6/site-packages/PyQt4/QtGui.so: mach-o, but wrong architecture What am I still doing wrong? Is there a specific way I have to run Python etc? Regards, Xiao -- http://mail.python.org/mailman/listinfo/python-list
Wholesale Sports Shoes Clear Air Force One AAA++quality(www.cnnshoe.com)
supply sports shoes. The brand Sports shoes basketball shoes, Boot, walling shoes, Athletic shoes, Jogging shoes, running shoes, leather shoes, football, shoe sports shoe Footwear Sneaker, Shox Max Rift T- shirts, womens t-shirts, Clothing womens clothing, wear hats Caps Jersey jeans Sock Jacks, Watches, wallet, handbags, and Jeans Lady Clothing and so on. Please contact us by email to get more information. please kindly visite our website: http://www.cnnshoe.com msn: cnnshoe2...@hotmail.com email: cnns...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list