Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91249 > unrolled thread
| Started by | al.basili@gmail.com (alb) |
|---|---|
| First post | 2015-05-26 15:48 +0000 |
| Last post | 2015-05-27 07:24 +0000 |
| Articles | 14 — 6 participants |
Back to article view | Back to comp.lang.python
SyntaxError on progress module al.basili@gmail.com (alb) - 2015-05-26 15:48 +0000
Re: SyntaxError on progress module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-26 16:59 +0100
Re: SyntaxError on progress module al.basili@gmail.com (alb) - 2015-05-27 07:30 +0000
Re: SyntaxError on progress module David Palao <dpalao.python@gmail.com> - 2015-05-27 09:47 +0200
Re: SyntaxError on progress module Chris Angelico <rosuav@gmail.com> - 2015-05-27 18:22 +1000
Re: SyntaxError on progress module Cecil Westerhof <Cecil@decebal.nl> - 2015-05-27 10:42 +0200
Re: SyntaxError on progress module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-27 14:44 +0100
Re: SyntaxError on progress module Cecil Westerhof <Cecil@decebal.nl> - 2015-05-27 16:11 +0200
Re: SyntaxError on progress module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-27 15:51 +0100
Re: SyntaxError on progress module Cecil Westerhof <Cecil@decebal.nl> - 2015-05-27 17:18 +0200
Re: SyntaxError on progress module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-27 21:03 +0100
Re: SyntaxError on progress module Steven D'Aprano <steve@pearwood.info> - 2015-05-28 11:39 +1000
Re: SyntaxError on progress module Chris Angelico <rosuav@gmail.com> - 2015-05-27 02:27 +1000
Re: SyntaxError on progress module al.basili@gmail.com (alb) - 2015-05-27 07:24 +0000
| From | al.basili@gmail.com (alb) |
|---|---|
| Date | 2015-05-26 15:48 +0000 |
| Subject | SyntaxError on progress module |
| Message-ID | <csjitvF6cptU1@mid.individual.net> |
Hi everyone,
I've installed the 'progress' module (ver 1.2) and I have the following
error when used:
File "/home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py", line 48
empty_fill = u'∙'
^
SyntaxError: invalid syntax
I believe I have some problems with unicode handling but it's just a
rough guess.
I'm running in a virtual environment with python3.2 with the following
configuration:
(venv)debian@debian:tex_tool$ pip list
pip (7.0.1)
progress (1.2)
pypandoc (0.9.7)
setuptools (15.0)
Any suggestions/comments/pointer is appreciated.
Al
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
[toc] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-26 16:59 +0100 |
| Message-ID | <mailman.58.1432655950.5151.python-list@python.org> |
| In reply to | #91249 |
On 26/05/2015 16:48, alb wrote: > Hi everyone, > > I've installed the 'progress' module (ver 1.2) and I have the following > error when used: > > File "/home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py", line 48 > empty_fill = u'∙' > ^ > SyntaxError: invalid syntax > > I believe I have some problems with unicode handling but it's just a > rough guess. > > I'm running in a virtual environment with python3.2 with the following > configuration: > > (venv)debian@debian:tex_tool$ pip list > pip (7.0.1) > progress (1.2) > pypandoc (0.9.7) > setuptools (15.0) > > Any suggestions/comments/pointer is appreciated. > > Al > Python 3.0 removed the 'u' for unicode in front of strings but due to popular demand to ease porting it was reinstated in 3.3. Strip it away and you should be fine to go. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | al.basili@gmail.com (alb) |
|---|---|
| Date | 2015-05-27 07:30 +0000 |
| Message-ID | <csla4lFjduaU2@mid.individual.net> |
| In reply to | #91251 |
Hi Mark, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: [] >> File "/home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py", line 48 >> empty_fill = u'∙' >> ^ >> SyntaxError: invalid syntax >> [] > > Python 3.0 removed the 'u' for unicode in front of strings but due to > popular demand to ease porting it was reinstated in 3.3. Strip it away > and you should be fine to go. I'm not particularly comfortable in fiddling with the library source, even if the change seems really minor, therefore I guess that I'll upgrade to a more recent version of Python/Debian. But here I have another question, as a python novice is there really any reason for me to use any particular version of Python? Should I start directly with the newest? What about 2.7? Al
[toc] | [prev] | [next] | [standalone]
| From | David Palao <dpalao.python@gmail.com> |
|---|---|
| Date | 2015-05-27 09:47 +0200 |
| Message-ID | <mailman.75.1432712834.5151.python-list@python.org> |
| In reply to | #91287 |
2015-05-27 9:30 GMT+02:00 alb <al.basili@gmail.com>: > Hi Mark, > Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > [] >>> File "/home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py", line 48 >>> empty_fill = u'∙' >>> ^ >>> SyntaxError: invalid syntax >>> > [] >> >> Python 3.0 removed the 'u' for unicode in front of strings but due to >> popular demand to ease porting it was reinstated in 3.3. Strip it away >> and you should be fine to go. > > I'm not particularly comfortable in fiddling with the library source, > even if the change seems really minor, therefore I guess that I'll > upgrade to a more recent version of Python/Debian. > > But here I have another question, as a python novice is there really any > reason for me to use any particular version of Python? > > Should I start directly with the newest? What about 2.7? > > Al > -- > https://mail.python.org/mailman/listinfo/python-list Hi, I would recommend to start with a 3.x Python. Perhaps 3.3 or 3.4? If the version provided by your OS is older, you can always use a virtual environment. Ask if you don't know about it. Best
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-05-27 18:22 +1000 |
| Message-ID | <mailman.77.1432714983.5151.python-list@python.org> |
| In reply to | #91287 |
On Wed, May 27, 2015 at 5:30 PM, alb <al.basili@gmail.com> wrote: > But here I have another question, as a python novice is there really any > reason for me to use any particular version of Python? > > Should I start directly with the newest? What about 2.7? > Start with the newest that's conveniently available. With Debian Jessie, Python 3.4.2 is a simple apt-get away, so that's pretty convenient. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-05-27 10:42 +0200 |
| Message-ID | <87y4kammxa.fsf@Equus.decebal.nl> |
| In reply to | #91287 |
Op Wednesday 27 May 2015 09:30 CEST schreef alb: > But here I have another question, as a python novice is there really > any reason for me to use any particular version of Python? > > Should I start directly with the newest? What about 2.7? In principal you should use the ‘latest’ 3. The only problem is that a lot of libraries are not converted to 3 yet. If you need one of those, then you have ‘no choice’ and have to use 2.7. But I would recommend to use ‘from __future__' to make the 2.7 code as much as possible 3 compliant. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-27 14:44 +0100 |
| Message-ID | <mailman.90.1432734279.5151.python-list@python.org> |
| In reply to | #91292 |
On 27/05/2015 09:42, Cecil Westerhof wrote: > Op Wednesday 27 May 2015 09:30 CEST schreef alb: > >> But here I have another question, as a python novice is there really >> any reason for me to use any particular version of Python? >> >> Should I start directly with the newest? What about 2.7? > > In principal you should use the ‘latest’ 3. The only problem is that a > lot of libraries are not converted to 3 yet. If you need one of those, > then you have ‘no choice’ and have to use 2.7. But I would recommend > to use ‘from __future__' to make the 2.7 code as much as possible 3 > compliant. > Please define "a lot" whilst bearing in mind green against red here https://python3wos.appspot.com/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-05-27 16:11 +0200 |
| Message-ID | <87siaim7p0.fsf@Equus.decebal.nl> |
| In reply to | #91309 |
Op Wednesday 27 May 2015 15:44 CEST schreef Mark Lawrence: > On 27/05/2015 09:42, Cecil Westerhof wrote: >> Op Wednesday 27 May 2015 09:30 CEST schreef alb: >> >>> But here I have another question, as a python novice is there >>> really any reason for me to use any particular version of Python? >>> >>> Should I start directly with the newest? What about 2.7? >> >> In principal you should use the ‘latest’ 3. The only problem is >> that a lot of libraries are not converted to 3 yet. If you need one >> of those, then you have ‘no choice’ and have to use 2.7. But I >> would recommend to use ‘from __future__' to make the 2.7 code as >> much as possible 3 compliant. >> > > Please define "a lot" whilst bearing in mind green against red here > https://python3wos.appspot.com/ I just started using Python again and the first ‘real’ program I wrote I had to write with Python 2 because the needed library (libturpial, that is not listed on your link) works only with Python 2. A short search about which of the two to use gives similar answers to mine. And as far as I can see in my neighbourhood Python 2 is almost exclusively used because used libraries are only available in Python 2. This is not a scientifically substantiated argument, but for me good enough to use a lot. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-27 15:51 +0100 |
| Message-ID | <mailman.91.1432738329.5151.python-list@python.org> |
| In reply to | #91313 |
On 27/05/2015 15:11, Cecil Westerhof wrote: > Op Wednesday 27 May 2015 15:44 CEST schreef Mark Lawrence: > >> On 27/05/2015 09:42, Cecil Westerhof wrote: >>> Op Wednesday 27 May 2015 09:30 CEST schreef alb: >>> >>>> But here I have another question, as a python novice is there >>>> really any reason for me to use any particular version of Python? >>>> >>>> Should I start directly with the newest? What about 2.7? >>> >>> In principal you should use the ‘latest’ 3. The only problem is >>> that a lot of libraries are not converted to 3 yet. If you need one >>> of those, then you have ‘no choice’ and have to use 2.7. But I >>> would recommend to use ‘from __future__' to make the 2.7 code as >>> much as possible 3 compliant. >>> >> >> Please define "a lot" whilst bearing in mind green against red here >> https://python3wos.appspot.com/ > > I just started using Python again and the first ‘real’ program I wrote > I had to write with Python 2 because the needed library (libturpial, > that is not listed on your link) works only with Python 2. A short > search about which of the two to use gives similar answers to mine. > And as far as I can see in my neighbourhood Python 2 is almost > exclusively used because used libraries are only available in Python > 2. > > This is not a scientifically substantiated argument, but for me good > enough to use a lot. > Have you actaully tried running libturpial with Python 3 or have you simply taken somebody or something's word for it? I've taken code in the past that was "only Python 2", run it thought the 2to3 fixer and job done. Perhaps you could do the same. Perhaps you've already tried. Again, you're the only person who actually knows. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-05-27 17:18 +0200 |
| Message-ID | <87oal6m4kn.fsf@Equus.decebal.nl> |
| In reply to | #91314 |
Op Wednesday 27 May 2015 16:51 CEST schreef Mark Lawrence: > On 27/05/2015 15:11, Cecil Westerhof wrote: >> Op Wednesday 27 May 2015 15:44 CEST schreef Mark Lawrence: >> >>> On 27/05/2015 09:42, Cecil Westerhof wrote: >>>> Op Wednesday 27 May 2015 09:30 CEST schreef alb: >>>> >>>>> But here I have another question, as a python novice is there >>>>> really any reason for me to use any particular version of >>>>> Python? >>>>> >>>>> Should I start directly with the newest? What about 2.7? >>>> >>>> In principal you should use the ‘latest’ 3. The only problem is >>>> that a lot of libraries are not converted to 3 yet. If you need >>>> one of those, then you have ‘no choice’ and have to use 2.7. But >>>> I would recommend to use ‘from __future__' to make the 2.7 code >>>> as much as possible 3 compliant. >>>> >>> >>> Please define "a lot" whilst bearing in mind green against red >>> here https://python3wos.appspot.com/ >> >> I just started using Python again and the first ‘real’ program I >> wrote I had to write with Python 2 because the needed library >> (libturpial, that is not listed on your link) works only with >> Python 2. A short search about which of the two to use gives >> similar answers to mine. And as far as I can see in my >> neighbourhood Python 2 is almost exclusively used because used >> libraries are only available in Python 2. >> >> This is not a scientifically substantiated argument, but for me >> good enough to use a lot. >> > > Have you actaully tried running libturpial with Python 3 or have you > simply taken somebody or something's word for it? I've taken code in > the past that was "only Python 2", run it thought the 2to3 fixer and > job done. Perhaps you could do the same. Perhaps you've already > tried. Again, you're the only person who actually knows. Of-course I tried: that is why I used “had to”. The library itself and libraries it depends on are only existing in a 2 version (at the moment). I write code that should work in 2 and 3 both as long as 2 is still a significant part. I call programs with python3 (even while it is 10 to 20 percent slower) and only when that is not possible I use Python 2. (Except to test if code also works with Python 2.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-27 21:03 +0100 |
| Message-ID | <mailman.98.1432757038.5151.python-list@python.org> |
| In reply to | #91315 |
On 27/05/2015 16:18, Cecil Westerhof wrote: > Op Wednesday 27 May 2015 16:51 CEST schreef Mark Lawrence: > >> On 27/05/2015 15:11, Cecil Westerhof wrote: >>> Op Wednesday 27 May 2015 15:44 CEST schreef Mark Lawrence: >>> >>>> On 27/05/2015 09:42, Cecil Westerhof wrote: >>>>> Op Wednesday 27 May 2015 09:30 CEST schreef alb: >>>>> >>>>>> But here I have another question, as a python novice is there >>>>>> really any reason for me to use any particular version of >>>>>> Python? >>>>>> >>>>>> Should I start directly with the newest? What about 2.7? >>>>> >>>>> In principal you should use the ‘latest’ 3. The only problem is >>>>> that a lot of libraries are not converted to 3 yet. If you need >>>>> one of those, then you have ‘no choice’ and have to use 2.7. But >>>>> I would recommend to use ‘from __future__' to make the 2.7 code >>>>> as much as possible 3 compliant. >>>>> >>>> >>>> Please define "a lot" whilst bearing in mind green against red >>>> here https://python3wos.appspot.com/ >>> >>> I just started using Python again and the first ‘real’ program I >>> wrote I had to write with Python 2 because the needed library >>> (libturpial, that is not listed on your link) works only with >>> Python 2. A short search about which of the two to use gives >>> similar answers to mine. And as far as I can see in my >>> neighbourhood Python 2 is almost exclusively used because used >>> libraries are only available in Python 2. >>> >>> This is not a scientifically substantiated argument, but for me >>> good enough to use a lot. >>> >> >> Have you actaully tried running libturpial with Python 3 or have you >> simply taken somebody or something's word for it? I've taken code in >> the past that was "only Python 2", run it thought the 2to3 fixer and >> job done. Perhaps you could do the same. Perhaps you've already >> tried. Again, you're the only person who actually knows. > > Of-course I tried: that is why I used “had to”. The library itself and > libraries it depends on are only existing in a 2 version (at the > moment). I write code that should work in 2 and 3 both as long as 2 is > still a significant part. I call programs with python3 (even while it > is 10 to 20 percent slower) and only when that is not possible I use > Python 2. (Except to test if code also works with Python 2.) > Did you, noting that you didn't actually answer my question, and also noting that you do ask a lot of questions yourself? So let's try again, did you or did you not run libturpial through 2to3? If yes what went wrong that stopped you porting it to Python 3? You make the statement regarding Python3 "even while it is 10 to 20 percent slower". Where is your evidence to support this statement? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-05-28 11:39 +1000 |
| Message-ID | <556671e3$0$13003$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #91323 |
On Thu, 28 May 2015 06:03 am, Mark Lawrence wrote: > You make the statement regarding Python3 "even while it is 10 to 20 > percent slower". Where is your evidence to support this statement? Its well known that Python 3 is generally slower than Python 2. Cecil's claim shouldn't be controversial, any more than "Python is generally about 10 to 100 times slower than C" should be controversial. But for what it's worth: [steve@ando ~]$ python2.7 -m timeit "i=1; L=sorted([30,20,50,10,40]); L[i+1]" 1000000 loops, best of 3: 1.54 usec per loop [steve@ando ~]$ python3.3 -m timeit "i=1; L=sorted([30,20,50,10,40]); L[i+1]" 1000000 loops, best of 3: 1.62 usec per loop which is an 8% slowdown. On the other hand: [steve@ando ~]$ python2.7 -m timeit "i='1'; L=sorted([30,20,50,10,40]); L[int(i)+1]" 100000 loops, best of 3: 2.6 usec per loop [steve@ando ~]$ python3.3 -m timeit "i='1'; L=sorted([30,20,50,10,40]); L[int(i)+1]" 100000 loops, best of 3: 2.29 usec per loop which is a 12% speed up. So the lesson is, micro-benchmarks are not a good guide to whole-application benchmarks. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-05-27 02:27 +1000 |
| Message-ID | <mailman.59.1432657630.5151.python-list@python.org> |
| In reply to | #91249 |
On Wed, May 27, 2015 at 1:59 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > On 26/05/2015 16:48, alb wrote: >> >> Hi everyone, >> >> I've installed the 'progress' module (ver 1.2) and I have the following >> error when used: >> >> File >> "/home/debian/repos/2418_IASI-NG/Documents/Tools/tex_tool/venv/local/lib/python3.2/site-packages/progress/bar.py", >> line 48 >> empty_fill = u'∙' >> ^ >> SyntaxError: invalid syntax >> >> I'm running in a virtual environment with python3.2 > > Python 3.0 removed the 'u' for unicode in front of strings but due to > popular demand to ease porting it was reinstated in 3.3. Strip it away and > you should be fine to go. Or upgrade to 3.3 or better; is there anything holding you on 3.2? Building CPython from source is pretty easy on Debian, and of course upgrading to Jessie will correspondingly upgrade you to a more recent Python (3.4, to be precise). ChrisA
[toc] | [prev] | [next] | [standalone]
| From | al.basili@gmail.com (alb) |
|---|---|
| Date | 2015-05-27 07:24 +0000 |
| Message-ID | <csl9p3FjduaU1@mid.individual.net> |
| In reply to | #91252 |
Hi Chris, Chris Angelico <rosuav@gmail.com> wrote: [] >> Python 3.0 removed the 'u' for unicode in front of strings but due to >> popular demand to ease porting it was reinstated in 3.3. Strip it away and >> you should be fine to go. > > Or upgrade to 3.3 or better; is there anything holding you on 3.2? > Building CPython from source is pretty easy on Debian, and of course > upgrading to Jessie will correspondingly upgrade you to a more recent > Python (3.4, to be precise). I moved recently from squeeze to wheezy in my production environment, I've nothing really holding me back on my current configuration... I'll give it a try in the coming days. Thanks for the prompt answer, Al -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web