Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
> Sorry, I didn't realize that you were using tornado and not asyncio. > Presumably it should be on whatever loop the wait call was awaited in, > but I have no idea how compatible asyncio constructs are with tornado > event loops. Exactly. I had the same doubts. > I think it's a bad idea because t

RE: Enum class

2015-10-15 Thread Joseph L. Casale
> Like that? > > >>> class M2(enum.EnumMeta): >... def __contains__(self, value): >... print(value, "? never", sep="") >... return False >... > >>> Colors.__class__ > > >>> Colors.red in Colors > checking Colors.red > True > >>> Colors.__class__ = M2 > >>> Colors.red in Colors

Re: Problem with copy.deepcopy and multiprocessing.Queue

2015-10-15 Thread James DeVincentis
Looking into it, I seem to have found a race condition where a multiprocessing.Queue.get() can get hung waiting for an object even if there are objects in the Queue when being placed into the queue by a forked process and then the process ending quickly. I don’t know how to track this down any

Re: Problem with copy.deepcopy and multiprocessing.Queue

2015-10-15 Thread James DeVincentis
I take that back. It’s not entirely fixed. Something else strange is going on here. More debugging needed. > On Oct 15, 2015, at 6:36 PM, James DeVincentis wrote: > > I think I tracked this down and resolved it. > > It appears taking an object from a multiprocess.Queue and placing it into

Re: Problem with copy.deepcopy and multiprocessing.Queue

2015-10-15 Thread James DeVincentis
I think I tracked this down and resolved it. It appears taking an object from a multiprocess.Queue and placing it into a queue.Queue is a no-no even if the queue.Queue isn’t shared across processes. I have a series of workers (multiprocessing) that share a multiprocess.Queue across all process

Re: Problem with copy.deepcopy and multiprocessing.Queue

2015-10-15 Thread Ian Kelly
On Thu, Oct 15, 2015 at 4:02 PM, James DeVincentis wrote: > > Anyone have any ideas? I feel like this could be a bug with the garbage collector across multiprocessing. I'll second MRAB's response from yesterday: could it just be reusing space that it has recently freed? As a debugging measure, w

RE: Problem with copy.deepcopy and multiprocessing.Queue

2015-10-15 Thread James DeVincentis
Anyone have any ideas? I feel like this could be a bug with the garbage collector across multiprocessing. From: James DeVincentis [mailto:ad...@hexhost.net] Sent: Wednesday, October 14, 2015 12:41 PM To: 'python-list@python.org' Subject: Problem with copy.deepcopy and multiprocessing.Queue

Re: How to repeat a loop once it is finished

2015-10-15 Thread Mark Lawrence
On 15/10/2015 15:06, abba...@centralfoundationboys.co.uk wrote: could you change it to python v3.4 Sorry no, try python 1.5, it's got far fewer bugs. As an alternative, please tell us what the hell you're on about, we're not mind readers. -- My fellow Pythonistas, ask not what our language

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread eryksun
On 10/15/15, Gisle Vanem wrote: > > Thanks for the detailed info. I fixed some paths under: >HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.5-32 > > Now my Python3.5 almost works. But something is wrong with the > Python3 sys.prefix: >c:> py -2 -c "import os, sys; print(sys.prefix)" >

Re: How to implement an async message bus

2015-10-15 Thread Ian Kelly
On Thu, Oct 15, 2015 at 11:16 AM, Nagy László Zsolt wrote: > In order to schedule a callback in the future, you would have to have a > standard event loop interface for scheduling. We do have a base class > asyncio.BaseEventLoop, but tornado's ioloop is NOT a descendant of it. > (It is based on to

Pyvenv use

2015-10-15 Thread Gary Roach
Hi all, I needed to switch a projects from python 2.7 to 3.4 and had trouble setting up the virtual environment using the virtualenvwrapper utility. It seemed to want to install python 2.7 no matter what I did. I switched to pyvenv which solved the problem. But I now need to completely clean

Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
>> async def waitfor(self, keys, timeout=None): >> """Wait until a message comes in for any of the given key(s). Raise >> BusTimeoutError after the given timedelta.""" >> >> >> >> Internally, the waitfor method would use the add_timeout to resume itself >> and raise the Bu

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread Gisle Vanem
eryksun wrote: The version of py.exe distributed with Python 3 is a 32-bit application, so when the debug output says it's looking in the "native" registry, it's referring to the WOW64 redirected registry path, i.e. "HKLM\Software\Wow6432Node\Python". If py.exe can't find your installation of Py

Re: Extended functions in embedded code

2015-10-15 Thread Ervin Hegedüs
Hi, I've read many docs and examples, then I made a usable test version. If anybody interested about this (and for the mailing list archives), then it could be found here: https://code.activestate.com/recipes/579110-add-function-to-__builtin__-module-through-c-api/ Hope this helps, and many than

Re: write csv to object and read into pandas

2015-10-15 Thread Vincent Davis
That worked, Thanks! Vincent Davis 720-301-3003 On Thu, Oct 15, 2015 at 6:11 AM, Peter Otten <__pete...@web.de> wrote: > Oscar Benjamin wrote: > > > On 15 October 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: > >> > >> def preprocess(filename): > >> with open(filename) as f: > >>

Re: Enum class

2015-10-15 Thread Peter Otten
Joseph L. Casale wrote: > import enum > class M(enum.EnumMeta): >>... def __contains__(self, value): >>... print("checking", value) >>... return super().__contains__(value) >>... > class Colors(enum.Enum, metaclass=M): >>... red = 1 >>... green = 2 >>...

Re: issues with Python

2015-10-15 Thread Ian Kelly
On Thu, Oct 15, 2015 at 8:04 AM, wrote: > > I am using the Python Programming third edition for absolute beginners. > I was able to create my Game over program, but I do not have the start menu > with the icons and cannot seem to find it. I have the Shell and the script > mode but I am not able t

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread eryksun
On 10/15/15, Gisle Vanem wrote: > > This is non-sense. I do have Python2 + 3 both on PATH (but both 32-bits). > Not sure if PyLauncher looks for 64-bit registry entries only. Running "py -3" doesn't use PATH. The launcher only uses PATH when evaluating "/usr/bin/env" in a virtual shebang, e.g. "#

Re: How to implement an async message bus

2015-10-15 Thread Ian Kelly
On Thu, Oct 15, 2015 at 5:25 AM, Nagy László Zsolt wrote: > I'm new to Python 3.5 async / await syntax. I would like to create a class - > let's call it AsyncBus - that can be used to listen for keys, and send > messages for keys ansynchronously. > > class BusTimeoutError(Exception): > pass >

Re: Enum class

2015-10-15 Thread Joseph L. Casale
import enum class M(enum.EnumMeta): >... def __contains__(self, value): >... print("checking", value) >... return super().__contains__(value) >... class Colors(enum.Enum, metaclass=M): >... red = 1 >... green = 2 >... blue = 3 >... Colors.red in C

Re: How to repeat a loop once it is finished

2015-10-15 Thread Denis McMahon
On Thu, 15 Oct 2015 06:29:24 -0700, abbasmo wrote: > what would be a small thing that I could add to make this thing run > again? See what happens when you run the following code. Then adapt it to your application. stop = False while not stop: x = input("enter something, quit, stop or end t

Re: How to repeat a loop once it is finished

2015-10-15 Thread Denis McMahon
On Thu, 15 Oct 2015 14:51:05 +0100, Mark Lawrence wrote: > On 15/10/2015 14:31, abba...@centralfoundationboys.co.uk wrote: >> if you could write a small piece of code for me it would great >> >> > If you used your favourite search engine in an attempt to write the code > before you ask questions a

issues with Python

2015-10-15 Thread vjdeluccie
I am using the Python Programming third edition for absolute beginners. I was able to create my Game over program, but I do not have the start menu with the icons and cannot seem to find it. I have the Shell and the script mode but I am not able to find the start menu with the icons the boo

Re: How to repeat a loop once it is finished

2015-10-15 Thread abbasmo
could you change it to python v3.4 -- https://mail.python.org/mailman/listinfo/python-list

Re: How to repeat a loop once it is finished

2015-10-15 Thread Mark Lawrence
On 15/10/2015 14:31, abba...@centralfoundationboys.co.uk wrote: if you could write a small piece of code for me it would great If you used your favourite search engine in an attempt to write the code before you ask questions about it, then that would be even better. Knowing what piece of cod

Adding Bottle framework in existing python script

2015-10-15 Thread gunjal . satish
In my python script I am doing bluetooth and RF communication on individual threads respectively. I want to add Rest Web Method in same script using Bottle web framework. If I add below code, in existing python script, it wont work. How to make it work in existing script. from bottle import Bo

Re: How to repeat a loop once it is finished

2015-10-15 Thread Nagy László Zsolt
> what would be a small thing that I could add to make this thing run again? Something like this? TERMINATOR = "STOP" def read_int(prompt,minvalue,maxvalue): while True: answer = raw_input(prompt) if answer.lower().strip() == TERMINATOR.lower().strip(): print "Us

Re: How to repeat a loop once it is finished

2015-10-15 Thread abbasmo
if you could write a small piece of code for me it would great -- https://mail.python.org/mailman/listinfo/python-list

How to repeat a loop once it is finished

2015-10-15 Thread abbasmo
import time #this is so that i can set a timer print ("only print numbers as your answers (Round all numbers up) also the programme adds 0.5 extra for cost of : ") time.sleep(2) #this is to let the person know what format to write it in# answer = input ("enter the height of the room walls betwee

Re: How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
> async def waitfor(self, keys, timeout=None): > """Wait for keys. > > :arg keys: An iterable of immutable keys. > :arg timeout: Raise TimeoutError if nothing hits the > bus for this amount of time. > None means: wait indefinitely. It

Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Jason Swails
On Wed, Oct 14, 2015 at 10:07 PM, Ben Finney wrote: > Jason Swails writes: > > > What I recently realized, though, that what this construct allows is > > for the coverage testing package (which I have recently started > > employing for my project... thanks Ned and others!) to detect whether > >

Re: help(string) commands not working on pyton 3.5

2015-10-15 Thread eryksun
On 10/14/15, Prasad Joshi wrote: > Hi, > > I have installed the "Windows x86-64 executable > installer" > on my desktop but I cannot get help ( ) or help (string) command working. > What could be an issue? > It may help to know which

Re: Enum class

2015-10-15 Thread Peter Otten
Joseph L. Casale wrote: > Is it possible to override __contains__ from the meta class in the derived > class with the Enum type? >>> import enum >>> class M(enum.EnumMeta): ... def __contains__(self, value): ... print("checking", value) ... return super().__contains__(value) .

Re: help(string) commands not working on pyton 3.5

2015-10-15 Thread Bob Gailer
Please show us exactly what you tried and exactly what the results were. For example: >>> help() Syntax error... On Oct 15, 2015 7:34 AM, "Prasad Joshi" wrote: > Hi, > > > > I have installed the “Windows x86-64 executable installer >

Re: write csv to object and read into pandas

2015-10-15 Thread Peter Otten
Oscar Benjamin wrote: > On 15 October 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: >> >> def preprocess(filename): >> with open(filename) as f: >> for row in csv.reader(f): >> # do stuff >> yield row >> >> rows = preprocess("pandas.csv") > > Take the wi

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread Gisle Vanem
eryksun wrote: Here's a slightly simpler way to open the folder: py -3.5 -c "import os, sys; os.startfile(sys.prefix)" And what to do if the Pylauncher itself seems confused or the Registry settings for PythonCore is messed up? The WOW64 mess MS has have seems to have caused some problem

help(string) commands not working on pyton 3.5

2015-10-15 Thread Prasad Joshi
Hi, I have installed the "Windows x86-64 executable installer" on my desktop but I cannot get help ( ) or help (string) command working. What could be an issue? Thanks! Prasad Joshi. -- https://mail.python.org/mailman/listinfo/pyt

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread John S James
Thank you, this is very helpful. John On Wed, Oct 14, 2015 at 3:31 PM, Zachary Ware wrote: > On Wed, Oct 14, 2015 at 2:05 PM, John S. James > wrote: > > I installed 3.5.0 today and it's working fine -- either from the command > prompt, or running a .py script. > > > > But the Python 3.4 that w

Enum class

2015-10-15 Thread Joseph L. Casale
Is it possible to override __contains__ from the meta class in the derived class with the Enum type? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

How to implement an async message bus

2015-10-15 Thread Nagy László Zsolt
I'm new to Python 3.5 async / await syntax. I would like to create a class - let's call it AsyncBus - that can be used to listen for keys, and send messages for keys ansynchronously. class BusTimeoutError(Exception): pass class AsyncBus(object): def __init__(self, add_timeout): ""

Re: write csv to object and read into pandas

2015-10-15 Thread Oscar Benjamin
On 15 October 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: > > def preprocess(filename): > with open(filename) as f: > for row in csv.reader(f): > # do stuff > yield row > > rows = preprocess("pandas.csv") Take the with statement outside of the generator

Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Peter Otten
Jason Swails wrote: > Hi everyone, > > I'd like to get some opinions about some coding constructs that may seem > at first glance to serve no purpose, but does have *some* non-negligible > purpose, and I think I've come to the right place :). > > The construct is this: > > def my_function(arg1,

Re: write csv to object and read into pandas

2015-10-15 Thread Peter Otten
Vincent Davis wrote: > I have a csv file I have to make some changes to before I read it into > pandas. Currently I open the csv read each row, make changes and save it > to a new file. Then read it into pandas with pandas.read_csv(). How do I > skip writing the file to disk? Using python3.5. > >