Re: import syntax

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 06:37 PM, Joshua Landau wrote: On 29 July 2013 21:23, Devyn Collier Johnson > wrote: On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote:

Re: Bitwise Operations

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 05:53 PM, Grant Edwards wrote: On 2013-07-29, Devyn Collier Johnson wrote: On Python3, how can I perform bitwise operations? For instance, I want something that will 'and', 'or', and 'xor' a binary integer. http://www.google.com/search?q=python+bitwise+operations I understand

Re: Bitwise Operations

2013-07-29 Thread Ethan Furman
On 07/29/2013 04:34 PM, Devyn Collier Johnson wrote: On 07/29/2013 05:53 PM, Grant Edwards wrote: On 2013-07-29, Devyn Collier Johnson wrote: On Python3, how can I perform bitwise operations? For instance, I want something that will 'and', 'or', and 'xor' a binary integer. http://www.google

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:34 AM, Devyn Collier Johnson wrote: > > I understand the symbols. I want to know how to perform the task in a script > or terminal. I have searched Google, but I never saw a command. Typing "101 > & 010" or "x = (int(101, 2) & int(010, 2))" only gives errors. Your probl

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Devyn Collier Johnson
Thanks everyone for your help. I installed AVbin v10. I no longer get Python errors, but no sound is produced. This is now an AVbin problem that I must figure out. At least I am done with the Python issues. For those of you that need AVbin: http://avbin.github.io/AVbin/Home/Home.html Mahal

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Ian Kelly
On Mon, Jul 29, 2013 at 4:04 PM, John Ladasky wrote: > pyglet-1.2alpha1/examples/programming_guide/hello_world.py runs fine. > > pyglet-1.2alpha1/examples/programming_guide/image_viewer.py also runs fine. > > pyglet-1.2alpha1/examples/programming_guide/animation.py produces an error. > Here's th

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 8:16 PM, Tim wrote: > My intent is to pass it a directory name or path and if it exists, use > shutil.rmtree to remove whatever is there (if it isn't a directory, try to > unlink it); then use os.makedirs to create a new directory or path: > > def make_clean_dir(directory

Re: Bitwise Operations

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 07:41 PM, Ethan Furman wrote: On 07/29/2013 04:34 PM, Devyn Collier Johnson wrote: On 07/29/2013 05:53 PM, Grant Edwards wrote: On 2013-07-29, Devyn Collier Johnson wrote: On Python3, how can I perform bitwise operations? For instance, I want something that will 'and', 'or',

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:48 AM, Devyn Collier Johnson wrote: > Now here is something that confuses me, the binary numbers are numbers not > strings, so why are they put in quotes as if they are strings? They aren't numbers at that point, they're strings of digits. A number is represented in var

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 30 July 2013 00:08, Rhodri James wrote: > On Mon, 29 Jul 2013 22:09:10 +0100, Steven D'Aprano < > steve+comp.lang.python@**pearwood.info> > wrote: > > On Mon, 29 Jul 2013 15:43:49 -0400, Devyn Collier Johnson wrote: >> >> In Python programming, the PEP8 recommends limiting lines to a maximum

Re: virtualenv problem

2013-07-29 Thread alex23
On 26/07/2013 10:25 PM, D. Xenakis wrote: Apparently my problem was that i did not have correctly setup the new path.. But hey - learning is a good thing +1! Also, good job on posting the solution you found as well, that's always helpful if anyone else hits the same problem. Personally, I t

Re: Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
Thanks for your reply, Joshua. >From the interpreter, I too can import pyglet, instantiate a >pyglet.window.Window, and have it pop up (although, following your directions, >now I can't CLOSE it because you didn't assign a name to it! :^]). I can get >all the help information as well. It look

Re: PEP8 79 char max

2013-07-29 Thread Rhodri James
On Tue, 30 Jul 2013 01:11:18 +0100, Joshua Landau wrote: On 30 July 2013 00:08, Rhodri James wrote: I'm working on some shonky C code at the moment that inconsistent indentation and very long lines. It is extremely annoying not to be able to put the original code, my "translation" and sund

Re: Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
G. Ian, thank you, you gave me a clue. I thought I was being careful about avoiding local imports. I just removed the tests directory from inside the pyglet-1.2alpha1 directory and tried running it from its new location. That got rid of the error message which was displaying uncorrected

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 1:47 AM, John Ladasky wrote: > I'm getting one problem. After a few tests run, I can't close a window. I > am normally closing each interactive test with the ESC key. But when that > fails I try clicking with the mouse. This also fails. This broken behavior > appear

Re: Bitwise Operations

2013-07-29 Thread MRAB
On 30/07/2013 00:34, Devyn Collier Johnson wrote: On 07/29/2013 05:53 PM, Grant Edwards wrote: On 2013-07-29, Devyn Collier Johnson wrote: On Python3, how can I perform bitwise operations? For instance, I want something that will 'and', 'or', and 'xor' a binary integer. http://www.google.co

SQLite logic error or missing database

2013-07-29 Thread CM
(Posted to SQLite users list first; 3 views so far, and no answers, so trying here, thinking that perhaps a Python user would have some clues; I hope that is OK) I am using SQLite through either Python 2.5 or 2.7, which is the sqlite3 module. In a desktop application, every now and then, and in

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 30 July 2013 01:41, Rhodri James wrote: > On Tue, 30 Jul 2013 01:11:18 +0100, Joshua Landau > wrote: > > On 30 July 2013 00:08, Rhodri James wrote: >> >>> I'm working on some shonky C code at the moment that inconsistent >>> indentation and very long lines. It is extremely annoying not to

Re: SQLite logic error or missing database

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:02 AM, CM wrote: > If I try additional commits in that same instance of my app being open, > it gives me the same error every time. If I close the app and re-open > it, it does not give me this error, with the same or very similar data > being written in the same routine

Re: PyQt5 and virtualenv problem

2013-07-29 Thread D. Xenakis
Could you help me install PyQt5 properly in my Virtualenv folder and not only globally? I tried installing PyQt5 and sip with the use of pip but i was getting errors all the time (Why is that? Are there any known pip issues along with PyQt5 and sip?), so in the end i had to install it with the

Re: [python] email 8bit encoding

2013-07-29 Thread rurpy
On 07/29/2013 12:16 AM, W. Trevor King wrote: > On Sun, Jul 28, 2013 at 04:41:27PM -0700, ru...@yahoo.com wrote: >> How, using Python-3.3's email module, do I "flatten" (I think >> that's the right term) a Message object to get utf-8 encoded >> body with the headers: >> Content-Type: text/plain; c

Re: must be dicts in tuple

2013-07-29 Thread Tim Roberts
Tanaya D wrote: > >I am using Python with Bots(EDI translator) > >But i am getting the following error: >MappingFormatError: must be dicts in tuple: get((({'BOTSID': 'HEADER'},),)) > >Can anyone pls help me with it. Possible hint: the error says you're supposed to have dicts in a tuple. What you

Re: Bitwise Operations

2013-07-29 Thread Peter Otten
Devyn Collier Johnson wrote: > On Python3, how can I perform bitwise operations? For instance, I want > something that will 'and', 'or', and 'xor' a binary integer. >>> 0b1010 | 0b1100 14 >>> bin(_) '0b1110' >>> 0b1010 & 0b1100 8 >>> bin(_) '0b1000' >>> 0b1010 ^ 0b1100 6 >>> bin(_) '0b110' --

Re: Bitwise Operations

2013-07-29 Thread Terry Reedy
On 7/29/2013 7:44 PM, Chris Angelico wrote: But there's an easier way: x = 0b101 & 0b010 x 0 I think that might do what you want. Also check out the bin() function, which will turn an integer into a string of digits. >>> bin(0b101 | 0b010) '0b111' Now you are set to go. Have fun. -- Terry

Re: collections.Counter surprisingly slow

2013-07-29 Thread Stefan Behnel
Serhiy Storchaka, 29.07.2013 21:37: > 29.07.13 20:19, Ian Kelly написав(ла): >> On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau wrote: >>> Also, couldn't Counter just extend from defaultdict? >> >> It could, but I expect the C helper function in 3.4 will be faster >> since it doesn't even need to ca

Re: collections.Counter surprisingly slow

2013-07-29 Thread Stefan Behnel
Stefan Behnel, 30.07.2013 08:39: > Serhiy Storchaka, 29.07.2013 21:37: >> 29.07.13 20:19, Ian Kelly написав(ла): >>> On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau wrote: Also, couldn't Counter just extend from defaultdict? >>> >>> It could, but I expect the C helper function in 3.4 will be fa

<    1   2