Re: Strang thing in tkinter, and pdb too?
Am 12.06.17 um 06:03 schrieb Terry Reedy: On 6/11/2017 10:06 PM, [email protected] wrote: D:\Temp\widget-tour-py3>python canvasruler.py can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" I have seen this too. It is not specific to any python/tkinter code, but is specific to exiting with some things destroyed and something not. This must be coming from tcl or tk, not python or tkinter. I can confirm that this is a Tk error message, with the following cause: In Tk, the root window with the name ".", which in Python comes to live with the Tk() function, determines the lifetime of a program. If you do: root=Tk() an empty window appears. If now the user closes this window with the "x" button on top, Tk stops - because usually this means that the program should stop - but Tcl does continue, in order to clean up stuff before leaving. If now further Tk commands are sent, they give the mentioned error: >>> import Tkinter >>> root=Tkinter.Tk() # here the window was closed using the "x" button >>> root # however the Tk() object still exists, # which is a Tcl interpreter with a dysfunct Tk >>> root.update() Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1019, in update self.tk.call('update') _tkinter.TclError: can't invoke "update" command: application has been destroyed >>> This behaviour makes the root window special in the sense that the whole application stops, when it is closed, because closing this window exits the mainloop(). This makes sense for many applications, however sometimes it does not. If you wish to create many windows which pop up by themselves and the user can close them freely, then one should withdraw the main window: root=Tkinter.Tk() root.withdraw() now the main window disappears, the user can't incidentally close it. One can then create additional toplevel windows using t=Tkinter.Toplevel() and place anything there. These can be closed without destroying the application / exiting the main loop. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Generate PDF with Tamil font problem
On Saturday, 5 March 2011 10:50:25 UTC+5:30, [email protected] wrote: > Hi All, > >I am using python's reportlab to print some unicode Tamil characters > 'பே'. I added necessary unicode font to reportlab. But It > prints the output as 'ேப' (in reverse order). This issue > happens for multi-byte characters, whereas for character 'ப' is > printed as it is. > I am struggling to figure out the issue. Any help would see me on track. > > Thank you, > -- > SatheeshKumar. P > +91 99446 38595 > +91 87544 15303 > [email protected] > [email protected] I am also facing the same problem with another similar Indian language- Malayalam. Has anybody encountered such issue and found any solution for this? -- https://mail.python.org/mailman/listinfo/python-list
Re: Generate PDF with Tamil font problem
On Mon, 12 Jun 2017 05:51 pm, [email protected] wrote: > On Saturday, 5 March 2011 10:50:25 UTC+5:30, [email protected] wrote: >> Hi All, >> >>I am using python's reportlab to print some unicode Tamil characters >> 'பே'. I added necessary unicode font to reportlab. But It >> prints the output as 'ேப' (in reverse order). This issue >> happens for multi-byte characters, whereas for character 'ப' is >> printed as it is. >> I am struggling to figure out the issue. Any help would see me on track. >> >> Thank you, [...] > I am also facing the same problem with another similar Indian language- > Malayalam. Has anybody encountered such issue and found any solution for this? You are replying to a six year old message from 2011. I doubt anyone remembers the details of that discussion. Please show us a SIMPLE example of this issue. If I try this, I get something which appears to be okay: py> print('\u2986\u3015') ⦆〕 but they don't appear to be Tamil characters? py> for c in '\u2986\u3015': ... unicodedata.name(c) ... 'RIGHT WHITE PARENTHESIS' 'RIGHT TORTOISE SHELL BRACKET' Let me try this instead: py> for c in (chr(2986), chr(3015)): ... unicodedata.name(c) ... 'TAMIL LETTER PA' 'TAMIL VOWEL SIGN EE' That's better! py> print(''.join([chr(2986), chr(3015)])) பே If you want help to diagnose and fix this, you will need to show us some simple code demonstrating the problem. Also tell us what output you expect, and what version of Python you are running. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
Cannot get any Python commands to work
I am trying to learn Django and cannot get easy_install to work. Python working on PyDev fine. PS C:\Windows\system32> python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> easy_install --version Traceback (most recent call last): File "", line 1, in NameError: name 'easy_install' is not defined >>> python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined >>> -- https://mail.python.org/mailman/listinfo/python-list
Re: Cannot get any Python commands to work
I believe that you need to be using this as a command rather a module from within python, in other words try executing easy_install from the command line, or try using pip which is now preferred method of installing new third-party packages. You may need to add '-3.6' or '-36' if you have multiple versions installed. On 12 June 2017 at 15:47, David Marquand wrote: > I am trying to learn Django and cannot get easy_install to work. Python > working on PyDev fine. > > > > > > > > > PS C:\Windows\system32> python > Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit > (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> easy_install --version > Traceback (most recent call last): > File "", line 1, in > NameError: name 'easy_install' is not defined > >>> python > Traceback (most recent call last): > File "", line 1, in > NameError: name 'python' is not defined > >>> > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
hello!! i was Installing Tensor flow with gpu support and something went wrong
hello!! I was trying to install Tensorflow on my laptop with Gpu support so I Installed python the one in the screenshot below, and I put in pip Tensorflow Install command and it says syntax error so i try to update the pip that too doesn't work desperate for solution help me. Regards Teenage wonders -- https://mail.python.org/mailman/listinfo/python-list
Re: Cannot get any Python commands to work
On Monday, June 12, 2017 at 11:34:41 AM UTC-5, Richard Moseley wrote: > I believe that you need to be using this as a command rather a module from > within python, in other words try executing easy_install from the command > line, or try using pip which is now preferred method of installing new > third-party packages. You may need to add '-3.6' or '-36' if you have > multiple versions installed. > > On 12 June 2017 at 15:47, David Marquand wrote: > > > I am trying to learn Django and cannot get easy_install to work. Python > > working on PyDev fine. > > > > > > > > > > > > > > > > > > PS C:\Windows\system32> python > > Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit > > (AMD64)] on win32 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> easy_install --version > > Traceback (most recent call last): > > File "", line 1, in > > NameError: name 'easy_install' is not defined > > >>> python > > Traceback (most recent call last): > > File "", line 1, in > > NameError: name 'python' is not defined > > >>> > > > > -- > > https://mail.python.org/mailman/listinfo/python-list > > Along with some others, you are right and this worked. Thank you. David -- https://mail.python.org/mailman/listinfo/python-list
Re: hello!! i was Installing Tensor flow with gpu support and something went wrong
On Monday, June 12, 2017 at 10:40:25 AM UTC-7, Forsaken uttax wrote: > hello!! >I was trying to install Tensorflow on my laptop with Gpu support > so I Installed python the one in the screenshot below, and I put in pip > Tensorflow Install command and it says syntax error so i try to update the > pip that too doesn't work desperate for solution help me. > > Regards > Teenage wonders You cannot attach a screen shot to the newsgroup. Building TensorFlow with GPU support is not simple. It involves far more than Python. I am investigating this issue myself. Check tensorflow.org for more information. Also, there is a TensorFlow newsgroup hosted on Google Groups. But before you take the trouble, are you sure that you need GPU support right away? You can explore neural nets on a CPU-only system, and in that configuration, TensorFlow installs easily. -- https://mail.python.org/mailman/listinfo/python-list
Re: Cannot get any Python commands to work
It seems like you are trying to run easy_install while running the Python interpreter. I am not familiar with easy_install, but my guess would be to run it outside the interpreter, in the command prompt. 2017-06-12 16:47 GMT+02:00 David Marquand mailto:[email protected]>>: I am trying to learn Django and cannot get easy_install to work. Python working on PyDev fine. PS C:\Windows\system32> python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> easy_install --version Traceback (most recent call last): File "", line 1, in NameError: name 'easy_install' is not defined >>> python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined >>> -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
How to store some elements from a list into another
Hello, I am stuck with a (perhaps) easy problem, I hope someone can help me: My problem is: I have a list of lists like this one: [[55, 56, 57, 58, 83, 84, 85, 86, 89, 90, 91, 92, 107, 108, 109, 110, 111, 117, 118, 119, 120, 128, 129, 130, 131, 135, 136, 137, 138, 184, 185, 186, 187, 216, 217, 218, 219, 232, 233, 234, 235, 236, 237, 238, 267, 268, 269, 270, 272, 273, 274, 275], [2, 3, 4, 5, 9, 10, 11, 12, 21, 22, 23, 24, 29, 30, 31, 32, 56, 57, 58, 59, 65, 66, 67, 68, 74, 75, 76, 77, 78, 89, 90, 91, 92, 98, 99, 100, 101, 102, 125, 126, 127, 128, 131, 132, 133, 134, 135]] And what I want is to store some of these datum into another list according to the next conditions: 1. I just want to store data if these values are consecutive (four in four), for instance, for first element I would like to store into the new list: [[[55,58],[83,86],[n,n+3]]] and so on. I tried something like this: x=0 y=0 while list6[x][y] == list6[x][y+1]-1 and list6[x][y] == list6[x][y+1]-2 and list6[x][y] == list6[x][y+1]-3 or list6[x][0]: list7.append(list6[x][y]) list7.append(list6[x][y+3]) y = y+1 if (list6[x][y])%(list6[x][len(list6[x])-1]) == 0: x= x+1 if len(list6[x]) == x and len(list6[x][y]) == y: break It does not work I appreciate your help Thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: How to store some elements from a list into another
On 2017-06-12 19:32, José Manuel Suárez Sierra wrote: Hello, I am stuck with a (perhaps) easy problem, I hope someone can help me: My problem is: I have a list of lists like this one: [[55, 56, 57, 58, 83, 84, 85, 86, 89, 90, 91, 92, 107, 108, 109, 110, 111, 117, 118, 119, 120, 128, 129, 130, 131, 135, 136, 137, 138, 184, 185, 186, 187, 216, 217, 218, 219, 232, 233, 234, 235, 236, 237, 238, 267, 268, 269, 270, 272, 273, 274, 275], [2, 3, 4, 5, 9, 10, 11, 12, 21, 22, 23, 24, 29, 30, 31, 32, 56, 57, 58, 59, 65, 66, 67, 68, 74, 75, 76, 77, 78, 89, 90, 91, 92, 98, 99, 100, 101, 102, 125, 126, 127, 128, 131, 132, 133, 134, 135]] And what I want is to store some of these datum into another list according to the next conditions: 1. I just want to store data if these values are consecutive (four in four), for instance, for first element I would like to store into the new list: [[[55,58],[83,86],[n,n+3]]] and so on. I tried something like this: x=0 y=0 Here you're checking whether list6[x][y+1] is list6[x][y]+1 _and_ list6[x][y]+2 _and_ list6[x][y]+3, all at the same time. That's not going to happen! while list6[x][y] == list6[x][y+1]-1 and list6[x][y] == list6[x][y+1]-2 and list6[x][y] == list6[x][y+1]-3 or list6[x][0]: list7.append(list6[x][y]) list7.append(list6[x][y+3]) y = y+1 if (list6[x][y])%(list6[x][len(list6[x])-1]) == 0: x= x+1 if len(list6[x]) == x and len(list6[x][y]) == y: break It does not work I appreciate your help Thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: How to store some elements from a list into another
On 12/06/17 20:32, José Manuel Suárez Sierra wrote:
> Hello,
> I am stuck with a (perhaps) easy problem, I hope someone can help me:
>
> My problem is:
> I have a list of lists like this one:
> [[55, 56, 57, 58, 83, 84, 85, 86, 89, 90, 91, 92, 107, 108, 109, 110, 111,
> 117, 118, 119, 120, 128, 129, 130, 131, 135, 136, 137, 138, 184, 185, 186,
> 187, 216, 217, 218, 219, 232, 233, 234, 235, 236, 237, 238, 267, 268, 269,
> 270, 272, 273, 274, 275], [2, 3, 4, 5, 9, 10, 11, 12, 21, 22, 23, 24, 29, 30,
> 31, 32, 56, 57, 58, 59, 65, 66, 67, 68, 74, 75, 76, 77, 78, 89, 90, 91, 92,
> 98, 99, 100, 101, 102, 125, 126, 127, 128, 131, 132, 133, 134, 135]]
>
> And what I want is to store some of these datum into another list according
> to the next conditions:
> 1. I just want to store data if these values are consecutive (four in four),
> for instance, for first element I would like to store into the new list:
> [[[55,58],[83,86],[n,n+3]]] and so on.
> I tried something like this:
Something similar to this should work with a few fixes (though it won't
be very "pythonic"). Let's look at what this code is doing!
>
> x=0
> y=0
> while list6[x][y] == list6[x][y+1]-1 and list6[x][y] ==
> list6[x][y+1]-2 and list6[x][y] == list6[x][y+1]-3 or list6[x][0]:
Right now, x=0, y=0, and I assume list6[0] is [55, 56, 57, 58, 83, ...]
so:
- list6[x][y] == list6[x][y+1]-1 is True: 55 == 56-1
- list6[x][y] == list6[x][y+1]-2 is False: 55 != 56-2
- list6[x][y] == list6[x][y+1]-3 is False: 55 != 56-3
- list6[x][0] is True: 55 != 0.
So the entire expression is equivalent to (at this moment:
while True and False and False or True:
which is equivalent to while True.
(Do you see the problem with your while statement?)
>
> list7.append(list6[x][y])
> list7.append(list6[x][y+3])
We enter the look and things are added to your list.
Anyway, I hope you see the mistake you made in your while condition.
> y = y+1
Are you sure you want to increase y by one only?
> if (list6[x][y])%(list6[x][len(list6[x])-1]) == 0:
> x= x+1
>
> if len(list6[x]) == x and len(list6[x][y]) == y:
> break
>
>
> It does not work
You should be able to figure out why it doesn't work (and fix it!) by
carefully checking what each step does. It's often helpful to add
print() calls at strategic places in your code to check what exactly
it's doing, and track what's going on. For example:
py> list6 = [[55, 56, 57, 58, 83, 84, 85, 86, 89, 90, 91, 92, 107, 108,
109, 110, 111, 117, 118, 119, 120, 128, 129, 130, 131, 135, 136, 137,
138, 184, 185, 186, 187, 216, 217, 218, 219, 232, 233, 234, 235, 236,
237, 238, 267, 268, 269, 270, 272, 273, 274, 275], [2, 3, 4, 5, 9, 10,
11, 12, 21, 22, 23, 24, 29, 30, 31, 32, 56, 57, 58, 59, 65, 66, 67, 68,
74, 75, 76, 77, 78, 89, 90, 91, 92, 98, 99, 100, 101, 102, 125, 126,
127, 128, 131, 132, 133, 134, 135]]
py> list7 = []
py> x=0
py> y=0
py> while list6[x][y] == list6[x][y+1]-1 and list6[x][y] ==
list6[x][y+1]-2 and list6[x][y] == list6[x][y+1]-3 or list6[x][0]:
... list7.append(list6[x][y])
... list7.append(list6[x][y+3])
... print('appended', list6[x][y], list6[x][y+3])
... y = y+1
... if (list6[x][y])%(list6[x][len(list6[x])-1]) == 0:
... x = x+1
... if len(list6[x]) == x and len(list6[x][y]) == y:
... break
...
appended 55 58
appended 56 83
appended 57 84
[...]
Traceback (most recent call last):
File "", line 3, in
IndexError: list index out of range
py> list7
[55, 58, 56, 83, 57, 84, 58, 85, 83, 86, 84, 89, 85, 90, 86, 91, 89, 92,
90, 107, 91, 108, 92, 109, 107, 110, 108, 111, 109, 117, 110, 118, 111,
119, 117, 120, 118, 128, 119, 129, 120, 130, 128, 131, 129, 135, 130,
136, 131, 137, 135, 138, 136, 184, 137, 185, 138, 186, 184, 187, 185,
216, 186, 217, 187, 218, 216, 219, 217, 232, 218, 233, 219, 234, 232,
235, 233, 236, 234, 237, 235, 238, 236, 267, 237, 268, 238, 269, 267,
270, 268, 272, 269, 273, 270, 274, 272, 275, 273]
py>
I hope these hints were of some help. I'll leave the next steps as an
exercise for you (learning to debug is important, and hard!). If you
come back when you've made some more progress, (or got it working) I'll
show you some more elegant solutions (unless someone else beats me to
it, of course).
Good luck
Thomas
>
> I appreciate your help
> Thank you
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: hello!! i was Installing Tensor flow with gpu support and something went wrong
On 6/12/2017 2:18 PM, [email protected] wrote: On Monday, June 12, 2017 at 10:40:25 AM UTC-7, Forsaken uttax wrote: hello!! I was trying to install Tensorflow on my laptop with Gpu support so I Installed python the one in the screenshot below, and I put in pip Tensorflow Install command and it says syntax error so i try to update the pip that too doesn't work desperate for solution help me. Regards Teenage wonders You cannot attach a screen shot to the newsgroup. Building TensorFlow with GPU support is not simple. It involves far more than Python. I am investigating this issue myself. Check tensorflow.org for more information. Also, there is a TensorFlow newsgroup hosted on Google Groups. There is also a tensorflow tag on Stackoverflow with lots of questions and, I hope, helpful answers. But before you take the trouble, are you sure that you need GPU support right away? You can explore neural nets on a CPU-only system, and in that configuration, TensorFlow installs easily. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Cannot get any Python commands to work
It seems like you are trying to run easy_install while running the Python interpreter. I am not familiar with easy_install, but my guess would be to run it outside the interpreter, in the command prompt. 2017-06-12 16:47 GMT+02:00 David Marquand mailto:[email protected]>>: I am trying to learn Django and cannot get easy_install to work. Python working on PyDev fine. PS C:\Windows\system32> python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> easy_install --version Traceback (most recent call last): File "", line 1, in NameError: name 'easy_install' is not defined >>> python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined >>> -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Cannot get any Python commands to work
On Mon, Jun 12, 2017 at 8:47 AM, David Marquand wrote: > I am trying to learn Django and cannot get easy_install to work. Python > working on PyDev fine. > > > PS C:\Windows\system32> python > Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit > (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. easy_install --version > Traceback (most recent call last): > File "", line 1, in > NameError: name 'easy_install' is not defined python > Traceback (most recent call last): > File "", line 1, in > NameError: name 'python' is not defined You need to run these from your regular OS shell, not from the Python interpeter. -- https://mail.python.org/mailman/listinfo/python-list
Customise the virtualenv `activate` script
Howdy all, What is the conventional way to customise the changes made by a Python virtualenv bin/activate script? The Python virtualenv is activated by a ‘$VENV/bin/activate script’ [0]. This script works primarily by setting environment variables specific to the virtualenv. (This is different from the “bootstrap script” discussed in the Virtualenv documentation. Those are used once, when creating the virtualenv; they are not used when activating the virtualenv. This question is about the activate script.) Many of the code bases for which I use a Python virtualenv, need additional (custom) environment variables set, each time the virtualenv is activated. How can I make this easy for developers who already know how to activate a virtualenv? * Edit the ‘$VENV/bin/activate’ script directly, to add statements that set more environment variables? * Write a custom wrapper script, that incidentally calls ‘$VENV/bin/activate’? * Write a separate script with a specific name, that will be automatically called by ‘$VENV/bin/activate’? Does such a thing exist? Of course I could write a script with a different name, and instruct developers to run that instead. Instead, this question is asking how to hook into the existing convention, of activating the virtualenv with a known name ‘$VENV/bin/activate’. [0] https://virtualenv.pypa.io/en/stable/userguide/#activate -- \ “It is clear that thought is not free if the profession of | `\ certain opinions makes it impossible to earn a living.” | _o__) —Bertrand Russell, _Free Thought and Official Propaganda_, 1928 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Why is it faster to first pickle data before sending a dict than sending a dict directly in Python 3?
Following test program:
import time
import marshal
try:
import cPickle as pickle
str_ = unicode
except:
import pickle
str_ = str
def TestPrc(rd):
d = rd.recv()
print("OK")
def TestPrc2(rd):
d = pickle.loads(rd.recv())
print("OK")
if __name__ == "__main__":
from multiprocessing import freeze_support, Process, Pipe
freeze_support()
d = { str_(x) : u"Hello World" + str_(x + 1) for x in range(100) }
wr, rd = Pipe()
p = Process(target = TestPrc, args = ( rd, ))
p.start()
t1 = time.time()
wr.send(d)
print("#1", time.time() - t1)
p.join()
print("#2", time.time() - t1)
p = Process(target = TestPrc2, args = ( rd, ))
p.start()
t1 = time.time()
wr.send(pickle.dumps(d, pickle.HIGHEST_PROTOCOL))
print("#3", time.time() - t1)
p.join()
print("#4", time.time() - t1)
I get the following results:
Python 2.7:
('#1', 0.3353814697266)
OK
('#2', 0.789343322754)
('#3', 0.36300015449523926)
OK
('#4', 0.805942779541)
Python 3.4:
#1 0.7770781517028809
OK
#2 1.4451451301574707
#3 0.7410738468170166
OK
#4 1.3691368103027344
Python 3.6:
#1 0.68121798706
OK
#2 1.150953674316
#3 0.654713897705
OK
#4 1.108675750732
The results show that in Python 3 it is faster to do the (un-)pickling in the
Python code. I would expect to have no real performance difference, or at least
the more straight forward way to send Python objects directly to be a bit
faster, as it is in Python 2.
Some other interesting results from this example:
- Python 2 is much faster
- At least Python 3.6 is much faster than Python 3.4
Regards,
Martin
--
https://mail.python.org/mailman/listinfo/python-list
