Re: [OT]Royal pardon for codebreaker Turing
Mark Lawrence wrote: > Maybe of interest to some of you > http://www.bbc.co.uk/news/technology-25495315 I think they got mixed up who'd have to pardon whom. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to check the date validity?
Am Mon, 23 Dec 2013 16:30:35 -0800 schrieb Igor Korot : > > Now, it looks that the python way of validating the date/time of the > string is to call strptime(). However looking at the docs and trying > to use the function I didn't find a way to check for the milliseconds. > Now the dates can be formatted differently I think according to the > locale under which the csv is generated. you can also use an validator package like formencode: http://www.formencode.org/en/latest/Validator.html It has an TimeConverter but it does not understand milliseconds either. But it should be trivial to implement it based on TimeConverter. Using formencode the validation / conversion is seperated and therefore reusable. You also get nice human readable validation messages in different languages. It supports also Schemas to validate complete records. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Please stop the trolling
Le lundi 23 décembre 2013 21:53:13 UTC+1, Terry Reedy a écrit : > On 12/23/2013 2:05 PM, [email protected] wrote: > > > > > Le lundi 23 décembre 2013 18:59:41 UTC+1, Wolfgang Keller a écrit : > > >> [me] > > >>> I'll note that Python core developers do care about memory leaks. > > >> And that's a really good thing. > > > > > Memory? Let me laugh! > > [snip repeated (for about the 5th time) posting of single character > > memory sizes] > > > > Jim, since I know you are smart enough to know the different between a > > small fixed size and a continuous leak, I can only think that the > > purpose of your repeated post was to get similarly a inane response from > > a couple of other people. That is the definition of trolling. It is > > disrespectful of others and in my opinion is a violation of the Python > > Code of Conduct, which *does* apply to python-list. Please desist. > > This is gui related. This code point could have been a grapheme of a korean glyph (Hangul script) used to to populate a text widget of a gui toolkit. jmf -- https://mail.python.org/mailman/listinfo/python-list
discover contents of a namespace package
Hello, I'm trying to use namespace packages (as described by PEP 420) to manage optional components of my Python package. I would like to discover which optional components are installed. Unfortunately, I have not found a straightforward way to do this. For regular packages, pkgutil.walk_packages() does this, but this doesn't work for namespace packages. Is there a way to discover the installed contents of a namespace package without manually reading the filesystem? Is there a way to do this using namespace packages created using pkgutil or pkg_resources? Thanks -- Brecht Machiels -- https://mail.python.org/mailman/listinfo/python-list
Re: Please stop the trolling
On 24/12/2013 10:22, [email protected] wrote: [once again snip double spaced google crap] This is gui related. http://en.wiktionary.org/wiki/pull_the_other_one,_it%27s_got_bells_on This code point could have been a grapheme of a korean glyph (Hangul script) used to to populate a text widget of a gui toolkit. jmf -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Please stop the trolling
On 12/24/13 9:58 AM, Mark Lawrence wrote: On 24/12/2013 10:22, [email protected] wrote: [once again snip double spaced google crap] This is gui related. http://en.wiktionary.org/wiki/pull_the_other_one,_it%27s_got_bells_on This isn't adding anything. It might even be trolling. This code point could have been a grapheme of a korean glyph (Hangul script) used to to populate a text widget of a gui toolkit. jmf No need to apologize, just don't taunt people for amusement. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Using asyncio in event-driven network library
Thanks for your answers! I didn't have the time to test any of your suggestions so far but they already gave me something to think about. At least now I'm much more clearer on what I am actually looking for. On 23.12.2013 20:59, Terry Reedy wrote: What would be easiest for user-developers would be if someone were able to wrap a gui loop in a way to give it the needed interface, so the gui loop itself replaced and became the asyncio loop. That's a good idea, maybe I will try this. On the other hand this means that for every gui toolkit there must be a separate wrapper. I hoped this can be avoided. On 23.12.2013 17:47, Chris Angelico wrote: You may be able to wrap your GUI code up so it fits inside asyncio. Rather than run a simple event loop, you could have your own loop that does some kind of checking: PyGTK has functions for peeking at events and doing just one iteration of the main loop, so you could pump all events with something like this: while gtk.events_pending(): gtk.main_iteration() No doubt other toolkits have something similar. On 23.12.2013 20:59, Terry Reedy wrote: I think tk(inter) has 'run pending events' or something. I didn't know functions like this exist in gui toolkits. Am I right in thinking that using these functions you don't have to use the built-in event loop. Instead you can write your own loop and just call 'run pending events' continuously? I think what I actually want is the other way around. I want my library to be easy to use in existing gui applications that already have their own main loop. Their core should not need to be adapted for this. So I think I should provide a function like 'run pending events' in my api. For example in a PyQt application this could be called periodically by using a QTimer. So I would use asyncio only if my library is used non-interactively with it's internal event loop. Well, maybe I could reuse asyncio's transports and protocols in both situations. I don't know if they depend on asyncio's event loop. Note: I didn't concern myself with all this stuff yet. Just wrote down what came to my mind. If there are any errors in my reasoning please correct me. I will try some approaches after the christmas holidays and get back to you then... Thanks and regards, Tobias -- https://mail.python.org/mailman/listinfo/python-list
Re: Please stop the trolling
On 24/12/2013 15:28, Ned Batchelder wrote: On 12/24/13 9:58 AM, Mark Lawrence wrote: On 24/12/2013 10:22, [email protected] wrote: [once again snip double spaced google crap] This is gui related. http://en.wiktionary.org/wiki/pull_the_other_one,_it%27s_got_bells_on This isn't adding anything. It might even be trolling. There is nothing trolling about it. How "Joseph McCarthy" can expect us to believe that he's talking about Guis when Terry has snipped this >>> sys.getsizeof('a') 26 >>> sys.getsizeof('€') 40 >>> 40 - 26 14 >>> sys.getsizeof('\U0001') 44 >>> 44 - 26 18 leaving only this Memory? Let me laugh! is anybody's guess hence my link. I will repeat, for perhaps the fourth time, that while JM continues his malicious attacks on the Python core developers via the nonsense that he writes about PEP 393 and the FSR, I will continue to attack him until he either shuts up or is shut up, or provides the evidence to support his claims. As the latter can never happen (he's had ample opportunity to do so, but strangely never replies to any requests to do just that), it will have to be the former by definition. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Please stop the trolling
On 12/24/13 10:55 AM, Mark Lawrence wrote: On 24/12/2013 15:28, Ned Batchelder wrote: On 12/24/13 9:58 AM, Mark Lawrence wrote: On 24/12/2013 10:22, [email protected] wrote: [once again snip double spaced google crap] This is gui related. http://en.wiktionary.org/wiki/pull_the_other_one,_it%27s_got_bells_on This isn't adding anything. It might even be trolling. There is nothing trolling about it. How "Joseph McCarthy" can expect us to believe that he's talking about Guis when Terry has snipped this >>> sys.getsizeof('a') 26 >>> sys.getsizeof('€') 40 >>> 40 - 26 14 >>> sys.getsizeof('\U0001') 44 >>> 44 - 26 18 leaving only this Memory? Let me laugh! is anybody's guess hence my link. I will repeat, for perhaps the fourth time, that while JM continues his malicious attacks on the Python core developers via the nonsense that he writes about PEP 393 and the FSR, I will continue to attack him until he either shuts up or is shut up, or provides the evidence to support his claims. As the latter can never happen (he's had ample opportunity to do so, but strangely never replies to any requests to do just that), it will have to be the former by definition. I agree that JM's complaints are baseless and silly. But they are not attacks on people. Criticizing the product is not criticizing the authors. You should stop attacking him. The best way to reduce the noise from JM is to ignore him. Your "defense" of the core developers is at least as distracting and detracting from this list's purpose as JM's baseless criticisms. The first step with a troll is to ignore them. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Variables in a loop, Newby question
Hello, for the first time I'm trying te create a little Python program. (on a raspberri Pi) I don't understand the handling of variables in a loop with Python. Lets say i want something like this. x = 1 while x <> 10 var x = x x = x + 1 The results must be: var1 = 1 var2 = 2 enz. until var9 = 9 How do i program this in python? -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On Tue, Dec 24, 2013 at 11:07 AM, wrote: > Hello, for the first time I'm trying te create a little Python program. > (on a raspberri Pi) > > I don't understand the handling of variables in a loop with Python. > > > Lets say i want something like this. > > x = 1 > while x <> 10 > var x = x > x = x + 1 > > The results must be: > > var1 = 1 > var2 = 2 > > enz. until var9 = 9 > > How do i program this in python? > -- > https://mail.python.org/mailman/listinfo/python-list > You might want to go to python.org and check out the documentation. I don't really understand what you are trying to do. The var1, var2 stuff doesn't make sense In python you can loop like this: for x in range(10): print x This will print the numbers from 0 to 9. But your best bet is to find a brief tutorial to get started. -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
- Original Message -
> Hello, for the first time I'm trying te create a little Python
> program. (on a raspberri Pi)
>
> I don't understand the handling of variables in a loop with Python.
>
>
> Lets say i want something like this.
>
> x = 1
> while x <> 10
> var x = x
> x = x + 1
>
> The results must be:
>
> var1 = 1
> var2 = 2
>
> enz. until var9 = 9
>
> How do i program this in python?
Short story, cause it's almost xmas eve :D:
python 2.5:
var = {}
for i in range(10):
var[i] = i
print var[1]
print var[2]
print var
var here is a dictionary. I suggest that you read through the python tutorial :)
JM
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be
privileged. If you are not the intended recipient, please notify the sender
immediately and do not disclose the contents to any other person, use it for
any purpose, or store or copy the information in any medium. Thank you.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On 24.12.2013 17:07, [email protected] wrote: Hello, for the first time I'm trying te create a little Python program. (on a raspberri Pi) I don't understand the handling of variables in a loop with Python. Lets say i want something like this. x = 1 while x <> 10 var x = x x = x + 1 The results must be: var1 = 1 var2 = 2 enz. until var9 = 9 How do i program this in python? You could do: x = 1 while x < 10: print(x) x += 1 But that would be very "unpythonic". Instead I would use a for loop and the range() function: for x in range(1,10): print(x) This is really short and readable. I recommend reading the python tutorial to understand the basics: http://docs.python.org/3/tutorial/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
[email protected] wrote: > Hello, for the first time I'm trying te create a little Python program. > (on a raspberri Pi) > > I don't understand the handling of variables in a loop with Python. > > > Lets say i want something like this. > > x = 1 > while x <> 10 > var x = x > x = x + 1 > > The results must be: > > var1 = 1 > var2 = 2 > > enz. until var9 = 9 > > How do i program this in python? You are trying to generate a variable name programatically. While this is possible in Python >>> x = 1 >>> while x != 10: ... exec("var{} = x".format(x)) ... x = x + 1 ... >>> var1 1 >>> var7 7 this is a really bad idea that you probably picked up from old code in a lesser language. Don't do it that way! In Python you should use a dict or a list, for example: >>> var = [] # an empty list >>> x = 0 >>> while x < 10: ... var.append(x) # append an item to the list ... x += 1 ... >>> var [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] This can be simplified to a single line: >>> var = list(range(10)) A few usage examples: >>> var[0] 0 >>> var[9] 9 >>> var[10] Traceback (most recent call last): File "", line 1, in IndexError: list index out of range As you can see list indices are zero-based. A list of length 10 has items 0 to 9. >>> var[7] += 42 >>> var [0, 1, 2, 3, 4, 5, 6, 49, 8, 9] >>> sum(var) 87 -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On 12/24/2013 11:07 AM, [email protected] wrote: Hello, for the first time I'm trying te create a little Python program. (on a raspberri Pi) I don't understand the handling of variables in a loop with Python. Lets say i want something like this. x = 1 while x <> 10 var x = x x = x + 1 The results must be: var1 = 1 var2 = 2 enz. until var9 = 9 How do i program this in python? The larger question is "why do you want to do that". It can be done but it is almost always a bad idea. Tell us what your goal is and we can tell you how we'd go about it. BTW when checking a condition in a while statement it is better practice to say while x < 10. In the above case it does not matter but if you were incrementing x by 2 your code would be in an infinite loop, mine would still stop. -- https://mail.python.org/mailman/listinfo/python-list
Re: Using asyncio in event-driven network library
On Wed, Dec 25, 2013 at 2:41 AM, Tobias M. wrote: > On 23.12.2013 17:47, Chris Angelico wrote: >> while gtk.events_pending(): gtk.main_iteration() > > On 23.12.2013 20:59, Terry Reedy wrote: >> >> I think tk(inter) has 'run pending events' or something. > > I didn't know functions like this exist in gui toolkits. Am I right in > thinking that using these functions you don't have to use the built-in event > loop. Instead you can write your own loop and just call 'run pending events' > continuously? That's correct. And if you do the blocking version of the call (not shown above), then it's exactly what the main loop function is doing. > I think what I actually want is the other way around. I want my library to > be easy to use in existing gui applications that already have their own main > loop. Their core should not need to be adapted for this. So I think I should > provide a function like 'run pending events' in my api. For example in a > PyQt application this could be called periodically by using a QTimer. That would work if you're okay with, effectively, polling for events. Might have a lot of cost in terms of performance (checking frequently) or response time (checking infrequently). I'd like to see the two-thread form explored; that effectively lets you block on two different events. You still get the advantage of asyncio (you don't need millions of threads - there's exactly two, one for GUI and one for everything else), but you're forced to think about your GUI first and give it the main thread. (At least, you are with several toolkits, which seem to insist on being used on the main thread only. You might be able to spin that off to another thread.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
import time
global Sens_Raw1, Sens_Raw2, Sens_Raw3, Sens_Raw4, Sens_Raw5, Sens_Raw6,
Sens_Raw7, Sens_Raw8, Sens_Raw9, Sens_Raw10
while True:
sensorids = ["28-054c4932", "28-054c9454", "28-054c9fca",
"28-054c4401", "28-054dab99", "28-054cf9b4", "28-054c8a03",
"28-054d$
avgtemperatures = []
for sensor in range (len(sensorids)):
temperatures = []
Sens_Raw = []
text = '';
while text.split("\n")[0].find("YES") == -1:
tfile = open("/sys/bus/w1/devices/"+
sensorids[sensor] +"/w1_slave")
text = tfile.read()
tfile.close()
time.sleep(0.1)
secondline = text.split("\n")[1]
temperaturedata = secondline.split(" ")[9]
temperature = float(temperaturedata [2:])
temperatures.append(temperature / 1000)
print "Sensor ", sensor + 1, temperatures
# Sens_Raw(sensor) = temperatures
This is the program I am trying to adjust. The goal is to make Sens_Raw1 to 10
global so I can use it in other programs on the Raspberry Pi. The print Sensor
wordks fine.
Thanks for any help!
--
https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On Tue, Dec 24, 2013 at 12:54 PM, wrote:
> import time
> global Sens_Raw1, Sens_Raw2, Sens_Raw3, Sens_Raw4, Sens_Raw5, Sens_Raw6,
> Sens_Raw7, Sens_Raw8, Sens_Raw9, Sens_Raw10
> while True:
> sensorids = ["28-054c4932", "28-054c9454",
> "28-054c9fca", "28-054c4401", "28-054dab99", "28-054cf9b4",
> "28-054c8a03", "28-054d$
>
It looks like the previous line is clipped at the end. It needs a closing
" and a closing ] at least.
> avgtemperatures = []
>
What is the above line for. It never reappears below
> for sensor in range (len(sensorids)):
> temperatures = []
>
You never use this either
> Sens_Raw = []
>
Or this.
> text = '';
>
No semicolon in python!
> while text.split("\n")[0].find("YES") == -1:
> tfile = open("/sys/bus/w1/devices/"+
> sensorids[sensor] +"/w1_slave")
> text = tfile.read()
> tfile.close()
> time.sleep(0.1)
> secondline = text.split("\n")[1]
> temperaturedata = secondline.split(" ")[9]
> temperature = float(temperaturedata [2:])
> temperatures.append(temperature / 1000)
> print "Sensor ", sensor + 1, temperatures
> # Sens_Raw(sensor) = temperatures
>
>
>
> This is the program I am trying to adjust. The goal is to make Sens_Raw1
> to 10 global so I can use it in other programs on the Raspberry Pi. The
> print Sensor wordks fine.
>
Again, not clear what you need. You certainly don't need globals. You may
want to collect all of the Sens_Raw stuff in a list. If you want that list
to useful to other code, you will need to put it in a module. Read about
namespaces.
There is nothing wrong with naming things with underscores between the
words. In fact its recommended.
Sorry, my brain is spinning. This code is useless. Why don't you try to
explain what you are trying to accomplish, and you will get better
answers. As it stands, you perhaps copied this from somewhere. What is
the data that gets written to text? Have you any programming skill,
perhaps with another language?
> Thanks for any help!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Joel Goldstick
http://joelgoldstick.com
--
https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
Indeed this is code what I found on the web to read temperatures from 10 DS18B20 singlewire sensors. My only programming (little) experience is VBA (Excel mostly). avgtemperatures = [] is indeed from the original code where this line 'avgtemperatures.append(sum(temperatures) / float(len(temperatures)))' was added. i removed it. You're right about the line sensorids. There are 10 sensors: sensorids = ["28-054c4932", "28-054c9454", "28-054c9fca", "28-054c4401", "28-054dab99", "28-054cf9b4", "28-054c8a03", "28-054d6780", $00054ccdfa", "28-054c4f9d"] In this script i want to read the temperatures and make them available to other scripts. One script to controll my solar water boiler and other heat exchangers connected to this boiler. (fire place for example) And in the future I want to make the temperatures available on a website and log them in a mysql database online. But as I said before, I am just a few days trying to learn how to do it. Thanks for your time. greetings Robert -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On Tue, 24 Dec 2013 09:54:48 -0800 (PST), [email protected] wrote: You should always start by mentioning python version and o.s. import time global Sens_Raw1, Sens_Raw2, Sens_Raw3, Sens_Raw4, Sens_Raw5, Sens_Raw6, Sens_Raw7, Sens_Raw8, Sens_Raw9, Sens_Raw10 The global statement makes no sense here, as you're not inside a function. Everything you've written is global. That means global to one module or source file. If you need to access data from another module you'll use import, and if you need to share with another process you'll need to use a file, a pipe, a queue, or some other mechanism. while True: sensorids = ["28-054c4932", "28-054c9454", "28-054c9fca", "28-054c4401", "28-054dab99", "28-054cf9b4", "28-054c8a03", "28-054d$ avgtemperatures = [] for sensor in range (len(sensorids)): temperatures = [] Sens_Raw = [] You're clobbering the list every time around the loop. Move this line before the loop. text = ''; while text.split("\n")[0].find("YES") == -1: tfile = open("/sys/bus/w1/devices/"+ sensorids[sensor] +"/w1_slave") text = tfile.read() tfile.close() time.sleep(0.1) secondline = text.split("\n")[1] temperaturedata = secondline.split(" ")[9] temperature = float(temperaturedata [2:]) temperatures.append(temperature / 1000) print "Sensor ", sensor + 1, temperatures # Sens_Raw(sensor) = temperatures Use Sens_Raw.append () to add to the end of the list. This is the program I am trying to adjust. The goal is to make Sens_Raw1 to 10 global so I can use it in other programs on the Raspberry Pi. The print Sensor wordks fine. Thanks for any help! -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT]Royal pardon for codebreaker Turing
* Steven D'Aprano [131224 07:05]: > On Tue, 24 Dec 2013 00:32:31 +, Mark Lawrence wrote: > > > Maybe of interest to some of you > > http://www.bbc.co.uk/news/technology-25495315 > > While I'm happy for Alan Turing, may he rest in peace, I think the > thousands of other homosexuals who have been prosecuted for something > which shouldn't be a crime in the first place might be a bit peeved that > he is singled out for a pardon. The LGBTs that I know are happy to hear about it... > Personally, I think that people ought to throw a party celebrating > Turing's rehabilitation, and do it right outside the Russian Embassy. :) Yeah! -- Tim tim at tee jay forty nine dot com or akwebsoft dot com http://www.akwebsoft.com, http://www.tj49.com -- https://mail.python.org/mailman/listinfo/python-list
Insert NULL into mySQL datetime
Hi, ALL,
I am working on a script that parses CSV file and after successful
parsing insert data ino mySQL table.
One of the fields in CSV holds a date+time value.
What the script should do is check if the cell has any data, i.e. not
empty and then make sure that the data is date+time.
If the validation fails, it should insert NULL into the mySQL datetime
field, otherwise the actual datetime will be inserted.
Right now the script uses a placeholder "-00-00 00:00:00.000" if
the date validation fails (either cell is empty or it has wrong data)
What I tried so far is:
C:\Documents and Settings\Igor.FORDANWORK\My Documents\GitHub\image_export\Artef
acts>python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb as mdb
>>> conn = mdb.connect('127.0.0.1','root','pass')
>>> cur = conn.cursor()
>>> a = None
>>> cur.execute("Use mydb")
0L
>>> cur.execute("Insert Into mytable(datefield) VALUES(STR_TO_DATE(%s))", a)
Traceback (most recent call last):
File "", line 1, in
File "c:\python27\lib\site-packages\MySQLdb\cursors.py", line 202, in execute
self.errorhandler(self, exc, value)
File "c:\python27\lib\site-packages\MySQLdb\connections.py", line
36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax
; check the manual that corresponds to your MySQL server version for
the right syntax to use near '%s))' at line 1")
>>> a = ""
>>> cur.execute("Insert Into mytable(datefield) VALUES(STR_TO_DATE(%s))", a)
Traceback (most recent call last):
File "", line 1, in
File "c:\python27\lib\site-packages\MySQLdb\cursors.py", line 202, in execute
self.errorhandler(self, exc, value)
File "c:\python27\lib\site-packages\MySQLdb\connections.py", line
36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1582, "Incorrect parameter count
in the call to native function 'STR_TO_DATE'")
>>>
Is it possible to do what I want?
I'd like to use one query to insert the data into the table.
Thank you.
--
https://mail.python.org/mailman/listinfo/python-list
Re: [OT]Royal pardon for codebreaker Turing
Tim Johnson wrote: > * Steven D'Aprano [131224 07:05]: >> On Tue, 24 Dec 2013 00:32:31 +, Mark Lawrence wrote: >> >> > Maybe of interest to some of you >> > http://www.bbc.co.uk/news/technology-25495315 >> >> While I'm happy for Alan Turing, may he rest in peace, I think the >> thousands of other homosexuals who have been prosecuted for something >> which shouldn't be a crime in the first place might be a bit peeved that >> he is singled out for a pardon. > > The LGBTs that I know are happy to hear about it... How many of them have been prosecuted themselves? If they have been, did they get pardoned as well? In case it wasn't obvious, I'm not objecting to Turing being pardoned. I'm suggesting that there are probably thousands of people whose lives were equally ruined, and they haven't been pardoned. I'm sure that Turing wasn't the only person who was forced into taking hormone "therapy", he probably wasn't the only person driven to suicide, and I know that he wasn't the only one who lost his job and career because of the hateful laws. Turing's prosecution was an especially spiteful example, given his role in the war effort, but many others suffered equally. Some may even be alive today. Where is their royal pardon? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On Tue, 24 Dec 2013 10:27:13 -0800, vanommen.robert wrote: > In this script i want to read the temperatures and make them available > to other scripts. The "global" keyword doesn't do that. "global" is used inside a function definition in python to tell the function that it is working with a global (to the program unit) variable. If you want this process to provide data to other processes, you might want to look at using a socket so they can request it as needed. -- Denis McMahon, [email protected] -- https://mail.python.org/mailman/listinfo/python-list
Re: Variables in a loop, Newby question
On 25Dec2013 02:54, Denis McMahon wrote: > On Tue, 24 Dec 2013 10:27:13 -0800, vanommen.robert wrote: > > In this script i want to read the temperatures and make them available > > to other scripts. [...] > If you want this process to provide data to other processes, you might > want to look at using a socket so they can request it as needed. Or just write it to a file for another process to open and read... -- Cameron Simpson Cordless hoses have been around for quite some time. They're called buckets. - Dan Prener -- https://mail.python.org/mailman/listinfo/python-list
nosetests vs. relative imports?
Environment: Ubuntu Linux 12.04 (precise) Python 2.7.3 I have a package (i.e. a directory with a __init__.py file). In that directory, I have files math.py and test_math.py; test_math.py contains the single line: from .math import EMA If I run on the command line, "nosetests test_math.py" everything is fine (it reports "Ran 0 tests in 0.001s", which is what I expect, since I haven't written any tests yet). But, if I leave off the .py, I get: $ nosetests test_math E == ERROR: Failure: ValueError (Attempted relative import in non-package) -- Traceback (most recent call last): File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/nose/l oader.py", line 413, in loadTestsFromName addr.filename, addr.module) File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/nose/i mporter.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/nose/i mporter.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/roy/deploy/current/code/songza/util/test_math.py", line 1, in from .math import EMA ValueError: Attempted relative import in non-package -- Ran 1 test in 0.001s What is going on that nose can't deal with the relative import when run that way? Nose has always felt like a magic ring. I'm really glad I discovered it because it makes my life so much better. But I'm never quite sure I really understand everything it's doing. -- https://mail.python.org/mailman/listinfo/python-list
