Questions about weakref

2018-10-16 Thread Frank Millman
ource. The source says 'return list(self.data)', and the docstring clearly states 'Return a list of weak references to the keys'. I think the docs should say the same. Should I raise an issue for this? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop

2016-04-08 Thread Frank Millman
k when I wanted to run a background task. It works perfectly for me. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: passing dictionay as argument

2016-06-13 Thread Frank Millman
ns syntax error: # define dictionary outside the function call: credit_card={ 'card_number': '4111', 'expiration_date': '04/2014', 'card_code': '343', } [...] result = authorize.Transaction.sale({'amount&#

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Frank Millman
d string in its own right. The correct way to write it is - print "A test case " + "str_1[%s] " % (str_1) + "str_2[%s]" % (str_2) If you wrote it without the '+' signs, the answer would be different. Python treats contiguous strings as a single string, so y

Re: python3: why writing to socket require bytes type while writing to a file require str ?

2016-07-22 Thread Frank Millman
n text mode, using 'w', it expects a string. If you open it in binary mode, using 'wb', it expects bytes. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Print Error

2016-07-26 Thread Frank Millman
ere you call int() - int(myAge) - so myAge must be an invalid literal. You could print it out and see what it is, but the traceback is already giving you that information for free. Can you see the '' at the end of the message. That is the contents of the invalid literal. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd truth result with in and ==

2018-11-23 Thread Frank Millman
n write this as bool([1, 2, 3]) == True True I have on vary rare occasions had to convert 'truthiness' to an actual boolean, and this is how I do it. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Error Python version 3.6 does not support this syntax.

2018-11-27 Thread Frank Millman
line 'return None', it may be complaining that None is superfluous - a plain 'return' does the same thing. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Complex 'compare'

2018-12-18 Thread Frank Millman
columns will be the primary key, so the two rows should never be equal. Thanks Frank Millman def compare(source_row, target_row, order, compare_type): # source_row - the row I want to compare - some sort columns could contain None # target_row - the row I want to compare it with - no sort

Re: Complex 'compare'

2018-12-18 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmpLuyFf04AT+34VraJ5itDvNySVJspEv=ddwdsmmsf...@mail.gmail.com... On Tue, Dec 18, 2018 at 9:52 PM Frank Millman wrote: > I need to know if one row is greater than or less than the other. The > sort > sequence can be complex -

Re: Complex 'compare'

2018-12-25 Thread Frank Millman
"Frank Millman" wrote on 2018-12-18 in message news:... I want to compare two tuples. They each represent a row in a database, and each element represents a column, so I will use that terminology. I need to know if one row is greater than or less than the other. The sort seque

Re: the python name

2019-01-02 Thread Frank Millman
#why-is-it-called-python HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practice for upgrading SQLite C library (DLL, SO, etc) that ships with Python

2019-01-05 Thread Frank Millman
can't comment about Linux or macOS, sorry. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Exercize to understand from three numbers which is more high

2019-01-27 Thread Frank Millman
which is the lowest. Give that a go, and come back here if you get stuck. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Exercize to understand from three numbers which is more high

2019-01-27 Thread Frank Millman
"^Bart" wrote in message news:q2kh0t$1hnj$1...@gioia.aioe.org... > You have got to a starting point - you have three numbers. Good. > > Where do you do go from here? > > I would start with two of the numbers, and work out which one is higher. # SOLVED!!! number1 = int( input("Insert the first

Re: Exercize to understand from three numbers which is more high

2019-01-28 Thread Frank Millman
"^Bart" wrote in message news:q2mghh$ah6$1...@gioia.aioe.org... > 1. The last two lines appear to be indented under the 'if number3 < ' > line. I think you want them to be unindented so that they run every > time. I'm sorry but I didn't completely understand what you wrote about the last t

Re: Implement C's Switch in Python 3

2019-02-03 Thread Frank Millman
'11th' chooseFrom[21] '21st' Not having a default case as in switch forced you to write out all possible combinations. I think the intent and readbility of switch statements is a bit nicer. I have not been following this thread in detail, but how about this

Stack Overflow Developer Survey

2019-04-13 Thread Frank Millman
first on the list - """ Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust). """ I thought

Re: How to concatenate strings with iteration in a loop?

2019-05-21 Thread Frank Millman
e string as per the above format? Thanks in advance The following (untested) assumes that you are using a reasonably up-to-date Python that has the 'f' format operator. tempStr = f'{year},{mon},{day},{UTCHrs[k]:6.4f}' for col in range(10): tempStr += f',{AExt[k, col]:9.7f}' HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: pyodbc -> MS-SQL Server Named Instance ?

2019-07-01 Thread Frank Millman
tabase, user=self.user, password=self.pwd, trusted_connection=True) SQL Server is running on the same host as my python program, so it may be a simpler setup than yours. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: pyodbc -> MS-SQL Server Named Instance ?

2019-07-02 Thread Frank Millman
On 2019-07-02 3:41 PM, Adam Tauno Williams wrote: On Tue, 2019-07-02 at 07:36 +0200, Frank Millman wrote: On 2019-07-01 10:13 PM, Adam Tauno Williams wrote: I am trying to connect to a Named Instance on an MS-SQL server using pyODBC. This is what I use -  conn = pyodbc.connect

Re: How Do You Replace Variables With Their Values?

2019-07-10 Thread Frank Millman
eparate lists called 'Starters', 'Main Course', and 'Desert'?", the code that you started with is exactly what you asked for. I think you were asking how to create a variable called 'Starters' containing the list of starters. It can be done, using th

Re: Accumulate , Range and Zeros

2019-07-13 Thread Frank Millman
default, range() starts from 0. Anything multiplied by 0 equals 0. So you can multiply as many numbers as you like, if the first one is 0, the rest will also be 0. QED Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Enumerate - int object not subscriptable

2019-08-20 Thread Frank Millman
): print(num[idx + 1], num) I am expecting 2, 1. But am receiving TypeError: 'int' object is not subscriptable Why? I think you want a[idx+1], not num[idx+1]. Bear in mind that you will get IndexError for the last item in the list. Frank Millman -- https://mail.python.org/mailma

Re: How should we use global variables correctly?

2019-08-23 Thread Frank Millman
27;, whereas with a global 'foo' there can only be one value of 'foo' for the module. It would make sense to use the 'global' keyword if you have a module with various functions, several of which refer to 'foo', but only one of which changes the value of 'foo'. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Compare zip lists where order is important

2019-08-28 Thread Frank Millman
x27;, 2)] What's a working way to go about this? This would have worked if you sorted your lists first - >>> [i for i, j in zip(sorted(teams), sorted(shuffle_teams)) if i != j] [('Ally', 2), ('Fredricka', 3), ('Tim', 1)] Except you wanted to see the re

Re: ``if var'' and ``if var is not None''

2019-08-31 Thread Frank Millman
On 2019-09-01 8:12 AM, Hongyi Zhao wrote: Hi, The following two forms are always equivalent: ``if var'' and ``if var is not None'' Regards Not so. Here is an example - >>> var = [] >>> bool(var) False >>> bool(var is not None) True >>

Re: phyton

2019-09-10 Thread Frank Millman
>>> my_dict = dict() >>> my_dict {} >>> my_dict = {} # this does the same, but is shorter >>> my_dict {} >>> my_dict['high'] = 21 >>> my_dict {'high': 21} >>> Try that, and report back with any questions Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Python in The Economist

2019-09-24 Thread Frank Millman
ng machines. That approach has attracted interest from DARPA ..." Hope this is of interest. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlalchemy & #temp tables

2019-10-07 Thread Frank Millman
you have a large volume of temp data, but it may be worth trying. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Instantiating sub-class from super

2019-10-15 Thread Frank Millman
ure 2) showing the data relationships. I downloaded the original article onto my computer years ago, and my local copy does have the images, so if you would like to see them let me know and I will upload my version somewhere to make it accessible. Frank Millman -- https://mail.python.org/m

Re: Instantiating sub-class from super

2019-10-16 Thread Frank Millman
On 2019-10-16 7:33 AM, Frank Millman wrote: Here is a link to an article entitled 'Understanding Hidden Subtypes'. It dates back to 2004, but I think it is still relevant. It addresses precisely the issues that you raise, but from a data-modelling perspective, not a programming o

Re: Instantiating sub-class from super

2019-10-24 Thread Frank Millman
On 2019-10-19 12:37 AM, DL Neil via Python-list wrote: On 16/10/19 6:33 PM, Frank Millman wrote: On 2019-10-14 10:55 PM, DL Neil via Python-list wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub

datetime gotcha

2019-12-10 Thread Frank Millman
object." If it was using multiple inheritance, a dtm should also be an instance of tm, but it is not. This is using Python 3.7.2. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: datetime gotcha

2019-12-12 Thread Frank Millman
On 2019-12-11 10:51 PM, Skip Montanaro wrote: Why is a dtm instance also an instance of dt? The datetime type is, in fact, a subclass of the date type: import datetime datetime.date.__bases__ (,) datetime.datetime.__bases__ (,) datetime.time.__bases__ (,) Skip Thanks for that. I fou

Re: Lists And Missing Commas

2019-12-23 Thread Frank Millman
mon. More likely is the use of a newline. I use this from time to time when constructing long string literals - long_string = ( "this is the first chunk " "this is the second chunk " "etc etc" ) My 0.02c Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: name 'sys' is not defined

2019-12-29 Thread Frank Millman
o add this line - import sys HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Fun with IO

2020-01-17 Thread Frank Millman
wait pdf_handler(client_writer) client_writer.write(b'\r\n') It works! ReportLab accepts client_writer as a file-like object, and writes to it directly. I cannot use chunking, so I just let it do its thing. Can anyone see any problem with this? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Sandboxing eval()

2020-01-21 Thread Frank Millman
quite difficult" I realised that my method is vulnerable to this and, like Robin, I have not come up with an easy way to guard against it. Frank Millman Just use floats instead of integers. I like that idea. I will probably use Decimal instead of float, but the principle is the sa

Re: Fun with IO

2020-01-21 Thread Frank Millman
On 2020-01-21 6:17 PM, Maxime S wrote: Hi, Le ven. 17 janv. 2020 à 20:11, Frank Millman a écrit : It works perfectly. However, some pdf's can be large, and there could be concurrent requests, so I wanted to minimise the memory footprint. So I tried passing the client_writer directly t

Re: Print statement

2020-01-28 Thread Frank Millman
can't multiply sequence by non-int of type 'float' >>> You probably meant float(squares) * float(.15) or more simply float(squares) * .15 HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

lxml - minor problem appending new element

2020-02-02 Thread Frank Millman
', 'b', 'c', 'd'] >>> >>> lmx = '' >>> xml = etree.fromstring(lmx) >>> for y in xml: ... print(etree.tostring(y)) ... if y.get('z') == 'c': ... xml.append(etree.Element('y', attrib={'z': 'd'})) ... b'' b'' b'' >>> etree.tostring(xml) b'' As you can see, the last element is correctly appended, but is not included in the iteration. Is there any chance that this can be looked at, or is it just the way it works? BTW, I see that ElementTree in the standard library does not have this problem. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: lxml - minor problem appending new element

2020-02-03 Thread Frank Millman
On 2020-02-03 10:39 AM, Peter Otten wrote: Frank Millman wrote: This is a minor issue, and I have found an ugly workaround, but I thought I would mention it. Like this? children = list(xml) for y in children: print(etree.tostring(y)) if y.get('z') == 'c&#

Change in behaviour Python 3.7 > 3.8

2020-02-06 Thread Frank Millman
. I have a workaround, so I am just reporting this for the record. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Change in behaviour Python 3.7 > 3.8

2020-02-06 Thread Frank Millman
On 2020-02-06 2:58 PM, Frank Millman wrote: [...] I have a module (A) containing common objects shared by other modules. I have a module (B) which imports one of these common objects - a set(). [...] This has worked for years, but now when the __del__ method is called, the common object

Re: Change in behaviour Python 3.7 > 3.8

2020-02-07 Thread Frank Millman
On 2020-02-07 1:06 PM, Barry Scott wrote: On 7 Feb 2020, at 05:27, Frank Millman wrote: @Barry I agree that __del__() is rarely useful, but I have not come up with an alternative to achieve what I want to do. My app is a long-running server, and creates many objects on-the-fly depending

Asyncio question

2020-02-20 Thread Frank Millman
he session is closed. Is this better, worse, or does it make no difference? If it makes no difference, I will lean towards the first approach, as it is easier to reason about what is going on. Thanks for any advice. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Asyncio question

2020-02-21 Thread Frank Millman
On 2020-02-21 11:13 PM, Greg Ewing wrote: On 21/02/20 7:59 pm, Frank Millman wrote: My first attempt was to create a background task for each session which runs for the life-time of the session, and 'awaits' its queue. It works, but I was concerned about having a lot a background tas

Why is passing loop argument to asyncio.Event deprecated?

2020-02-22 Thread Frank Millman
Hi all Why is 'explicit passing of a loop argument to asyncio.Event' deprecated (see What's new in Python 3.8)? I use this in my project. I can find a workaround, but it is not elegant. I can explain my use case if requested, but I was just curious to find out the reason.

Re: python

2020-02-22 Thread Frank Millman
IN, or is ignored as neither. Now -- write a program does just that... """ Try his suggestion, and come back here if you get stuck. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Asyncio question (rmlibre)

2020-02-28 Thread Frank Millman
On 2020-02-28 1:37 AM, rmli...@riseup.net wrote: > What resources are you trying to conserve? > > If you want to try conserving time, you shouldn't have to worry about > starting too many background tasks. That's because asyncio code was > designed to be extremely time efficient at handling larg

Intermittent bug with asyncio and MS Edge

2020-03-21 Thread Frank Millman
() writer.close() await writer.wait_closed() I have asked the same question on StackOverflow, from an MS Edge perspective - https://stackoverflow.com/questions/60785767/ms-edge-randomly-does-not-load-script I don't know whether the problem lies with Python or MS Edge, but a

Re: Intermittent bug with asyncio and MS Edge

2020-03-22 Thread Frank Millman
On 2020-03-21 8:04 PM, Barry Scott wrote: On 21 Mar 2020, at 13:43, Frank Millman wrote: Hi all I have a strange intermittent bug. The role-players - asyncio on Python 3.8 running on Windows 10 Microsoft Edge running as a browser on the same machine The bug does not occur with

Re: Intermittent bug with asyncio and MS Edge

2020-03-22 Thread Frank Millman
On 2020-03-22 10:45 AM, Chris Angelico wrote: On Sun, Mar 22, 2020 at 6:58 PM Frank Millman wrote: I'd look at the network traffic with wireshark to see if there is anything different between edge and the other browsers. You are leading me into deep waters here :-) I have never

Re: Intermittent bug with asyncio and MS Edge

2020-03-22 Thread Frank Millman
On 2020-03-22 11:00 AM, Barry Scott wrote: On 22 Mar 2020, at 07:56, Frank Millman wrote: On 2020-03-21 8:04 PM, Barry Scott wrote: I'd look at the network traffic with wireshark to see if there is anything different between edge and the other browsers. You are leading me into

Re: Intermittent bug with asyncio and MS Edge

2020-03-22 Thread Frank Millman
On 2020-03-22 1:01 PM, Chris Angelico wrote: On Sun, Mar 22, 2020 at 12:45 AM Frank Millman wrote: Hi all I have a strange intermittent bug. The role-players - asyncio on Python 3.8 running on Windows 10 Microsoft Edge running as a browser on the same machine The bug does not

Re: Intermittent bug with asyncio and MS Edge

2020-03-23 Thread Frank Millman
On 2020-03-22 12:11 PM, Chris Angelico wrote: On Sun, Mar 22, 2020 at 8:30 PM Frank Millman wrote: On 2020-03-22 10:45 AM, Chris Angelico wrote: If you can recreate the problem with a single socket and multiple requests, that would be extremely helpful. I also think it's highly likely

Re: Intermittent bug with asyncio and MS Edge

2020-03-23 Thread Frank Millman
On 2020-03-23 12:57 PM, Chris Angelico wrote: On Mon, Mar 23, 2020 at 8:03 PM Frank Millman wrote: On 2020-03-22 12:11 PM, Chris Angelico wrote: On Sun, Mar 22, 2020 at 8:30 PM Frank Millman wrote: On 2020-03-22 10:45 AM, Chris Angelico wrote: If you can recreate the problem with a

Re: Intermittent bug with asyncio and MS Edge

2020-03-24 Thread Frank Millman
On 2020-03-23 1:56 PM, Frank Millman wrote: On 2020-03-23 12:57 PM, Chris Angelico wrote: On Mon, Mar 23, 2020 at 8:03 PM Frank Millman wrote: On 2020-03-22 12:11 PM, Chris Angelico wrote: On Sun, Mar 22, 2020 at 8:30 PM Frank Millman wrote: On 2020-03-22 10:45 AM, Chris Angelico wrote

Re: Intermittent bug with asyncio and MS Edge

2020-03-24 Thread Frank Millman
On 2020-03-24 1:54 PM, Frank Millman wrote: On 2020-03-23 1:56 PM, Frank Millman wrote: I have one frustration with Wireshark. I will mention it in case anyone has a solution. I can see that Edge opens multiple connections. I am trying to track the activity on each connection separately. I

Re: Intermittent bug with asyncio and MS Edge

2020-03-24 Thread Frank Millman
On 2020-03-24 8:39 PM, Barry Scott wrote: On 24 Mar 2020, at 11:54, Frank Millman wrote: I decided to concentrate on using Wireshark to detect the difference between a Python3.7 session and a Python3.8 session. Already I can see some differences. There is only one version of my program

Re: "pip" error message

2020-04-21 Thread Frank Millman
re discussing how to improve the download experience on Windows for newbies. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Strings: double versus single quotes

2020-05-23 Thread Frank Millman
dding more and more SQL in my code. How do you handle parameters? Do you leave placeholders ('?' or '%s') in the query, and leave it to the 'importer' of the query to figure out what is required? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Strings: double versus single quotes

2020-05-24 Thread Frank Millman
On 2020-05-24 9:58 AM, DL Neil via Python-list wrote: On 24/05/20 5:43 PM, Frank Millman wrote: On 2020-05-23 9:45 PM, DL Neil via Python-list wrote: My habit with SQL queries is to separate them from other code, cf the usual illustration of having them 'buried' within the code, i

Re: [Beginner] Spliting input

2020-06-25 Thread Frank Millman
input("enter 1st and 2nd no ").split() ValueError: not enough values to unpack (expected 2, got 1) Without arguments, split() splits on whitespace. If you entered 2 numbers separated by a comma, but no spaces, there is no split. Maybe you meant split(',') whi

Re: Bulletproof json.dump?

2020-07-06 Thread Frank Millman
'datetime.date(2020, 7, 6)'. I look for that pattern on retrieval to detect that it is actually a date object. I use the same trick for Decimal objects. Maybe the OP could do something similar. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Bulletproof json.dump?

2020-07-06 Thread Frank Millman
On 2020-07-06 3:08 PM, Jon Ribbens via Python-list wrote: On 2020-07-06, Frank Millman wrote: On 2020-07-06 2:06 PM, Jon Ribbens via Python-list wrote: While I agree entirely with your point, there is however perhaps room for a bit more helpfulness from the json module. There is no sensible

Access last element after iteration

2020-07-07 Thread Frank Millman
using the last element, I assume that this would be the way to do it - >>> for i in range(5): ... print(i) ... j = i ... 0 1 2 3 4 >>> print(j) 4 >>> Alternatively, this also works, but is this one guaranteed? >>> for i in range(5): ... print(i) .

Re: Need tests of turtledemo.colordemo on Windows installations

2020-09-13 Thread Frank Millman
est with no issues at all. I will upgrade to 3.8.5 later today and try again. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Need tests of turtledemo.colordemo on Windows installations

2020-09-13 Thread Frank Millman
On 2020-09-14 7:07 AM, Frank Millman wrote: On 2020-09-14 3:18 AM, Terry Reedy wrote: User Tushar Sadhwani and I both have Win 10 with 3.8.5 installed. When he runs ...> py -3.8 -m turtledemo.colormixer and moves the sliders a reasonable amount, he repeatably gets Fatal Python error: Can

Re: Pythonic style

2020-09-21 Thread Frank Millman
I made the mistake of relying on the error message in my logic, to distinguish between 'too few' and 'too many'. Guess what happened - Python changed the wording of the messages, and my logic failed. After messing about with some alternatives, I ended up with the OP's f

list comprehension namespace problem

2020-09-24 Thread Frank Millman
ing on? Q2. Is there a way to get what I want? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: list comprehension namespace problem

2020-09-24 Thread Frank Millman
On 2020-09-25 7:46 AM, Chris Angelico wrote: On Fri, Sep 25, 2020 at 3:43 PM Frank Millman wrote: Hi all I have a problem related (I think) to list comprehension namespaces. I don't understand it enough to figure out a solution. In the debugger, I want to examine the contents of the cu

Debugging technique

2020-10-02 Thread Frank Millman
using the extra info from the traceback. Is there a way to combine these into one step, so that, while in the debugger, I can find out how I got there? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Debugging technique

2020-10-03 Thread Frank Millman
On 2020-10-03 8:58 AM, Chris Angelico wrote: On Sat, Oct 3, 2020 at 4:53 PM Frank Millman wrote: Hi all When debugging, I sometimes add a 'breakpoint()' to my code to examine various objects. However, I often want to know how I got there, so I replace the 'breakpoint()&#x

Re: How do I get datetime to stop showing seconds?

2020-10-16 Thread Frank Millman
On 2020-10-16 9:42 AM, Steve wrote: d2 = datetime.datetime.now() #Time Right now Show this: 2020-10-16 02:53 and not this: 2020-10-16 02:53:48.585865 >>> >>> str(d2) '2020-10-16 10:29:38.423371' >>> >>> d2.strftime('%Y-%m-%d %H:%M

Re: Basic Python help

2020-10-23 Thread Frank Millman
ng. So the result is the concatenation of - 1. '\n' + '#' + length of string + '\n' as the start delimiter 2. the string itself 3. '\n' + '#' + '#' + '\n' as the end delimiter Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

asyncio question

2020-11-03 Thread Frank Millman
x27; method, KeyboardInterrupt is not caught by 'server.serve_forever()' but by 'asyncio.run()'. It is too late to do any cleanup at this point, as the loop has already been stopped. Is it ok to stick to the 'old' method, or is there a better way to do this. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a conflict of libraries here?

2020-11-05 Thread Frank Millman
move the line 'from datetime import datetime'. 2. Change dt = datetime.fromisoformat(ItemDateTime) to dt = datetime.datetime.fromisoformat(ItemDateTime) Unless I have missed something, that should work. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:28 PM, Frank Millman wrote: On 2020-11-07 1:03 PM, Bischoop wrote: [...] another example: text = "this is text, there should be not commas, but as you see there are still" y = txt.strip(",") print(text) output: this is text, there should be not commas,

Python in The Economist

2005-09-27 Thread Frank Millman
FYI http://www.economist.com/science/displayStory.cfm?Story_id=4368122&CFID=65783500&CFTOKEN=ed98f5-9eb5adc6-80da-4e08-a843-746292fe83b8 Frank Millman -- http://mail.python.org/mailman/listinfo/python-list

Question about StringIO

2005-10-09 Thread Frank Millman
but hopefully this is enough for a simple yes or no answer, and if so, how. BTW, I have tried using popen2() and passing my data via stdin, but the other program (psql) does not react well to this - again, I will give more info if necessary. Thanks Frank Millman -- http://mail.python.org/mail

Re: Question about StringIO

2005-10-10 Thread Frank Millman
Diez B. Roggisch wrote: > Frank Millman wrote: > > Hi all > > > > I understand that StringIO creates a file-like object in memory. > > > > Is it possible to invoke another program, using os.system() or > > os.popen(), and use the < redirect operat

Re: Question about StringIO

2005-10-11 Thread Frank Millman
Benjamin Niemann wrote: > Frank Millman wrote: > > > I will try to explain my experience with popen() briefly. > > > > I run through all the scripts and create a StringIO object with the > > string I want to pass. It is about 250 000 bytes long. If I run psql >

Re: Question about StringIO

2005-10-11 Thread Frank Millman
Diez B. Roggisch wrote: > > Thanks, Steve and Diez, for the replies. I didn't think it was > > possible, but it was worth asking :-) > > > > I will try to explain my experience with popen() briefly. > > > > I have some sql scripts to create tables, indexes, procedures, etc. At > > present there are

Re: Question about StringIO

2005-10-11 Thread Frank Millman
Diez B. Roggisch wrote: > > Thanks for this pointer. I have read it, but I don't think it applies > > to my situation, as it talks about 'reading' from the child's stdout > > while the child is 'writing' to stderr. > > But that is exactly the point: the psql blocks because you don't read > away th

Re: Question about StringIO

2005-10-11 Thread Frank Millman
Diez B. Roggisch wrote: > > My scripts are used to create the tables in the database. I didn't > > think that DB-API covered that. > > The DB-Api covers executin arbirary SQL - either DDL or DML. It is > surely centered around DML, but that doesn't mean that its not usabel to > issue "create ..."

Re: looking for a good python module for MS SQL server

2005-10-31 Thread Frank Millman
Anat wrote: > Hi, > Does anyone know a good python mudule that works with MS SQL server? > Thanks, > Anat I use the odbc module from pywin32. I believe that it is not 100% DB-API 2.0 compliant, but it works fine for me. It has the advantage that if you have installed pywin32 (which is advisable o

Re: looking for a good python module for MS SQL server

2005-11-02 Thread Frank Millman
Peter Decker wrote: > On 11/1/05, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > > > Things didn't change, as last update to adodbapi was long time ago... I > > had no problems with stored procedures accessed using cursor's execute() > > method (i.e. execute('exec sp_someproc, param')), but I never trie

sax.make_parser() segfaults

2005-11-29 Thread Frank Millman
supply as much info as possible. As mentioned above, I do not have the problem with MSW. Any suggestions will be much appreciated. Thanks Frank Millman -- http://mail.python.org/mailman/listinfo/python-list

Re: sax.make_parser() segfaults

2005-11-29 Thread Frank Millman
Frank Millman wrote: > Hi all > > I am using Python 2.4.1. I have machines running FC4, RH9, and MSW > Server 2003 for testing. > > If I call sax.make_parser() from the interpreter or from a stand-alone > program, it works fine on all machines, but in the following setup it

Re: sax.make_parser() segfaults

2005-11-30 Thread Frank Millman
Frank Millman wrote: > > Hi all > > > > I am using Python 2.4.1. I have machines running FC4, RH9, and MSW > > Server 2003 for testing. > > > > If I call sax.make_parser() from the interpreter or from a stand-alone > > program, it works fine on a

Re: sax.make_parser() segfaults

2005-12-01 Thread Frank Millman
Bernhard Herzog wrote: > "Frank Millman" <[EMAIL PROTECTED]> writes: > > >> > If I call sax.make_parser() from the interpreter or from a stand-alone > >> > program, it works fine on all machines, but in the following setup it > >> >

Re: sql escaping module

2005-12-08 Thread Frank Millman
required by the underlying API. Unfortunately the DB-API allows a choice of 'paramstyles'. There may be technical reasons for this, but it does make supporting multiple databases awkward. Frank Millman -- http://mail.python.org/mailman/listinfo/python-list

Re: sql escaping module - Frank Millman Followup

2005-12-08 Thread Frank Millman
David Bear wrote: > > The statement above can cause relief or pain. Letting the DBAPI handle > proper string escapes, formating, etc., is a big relief. However, I am > still wondering what happens under the covers. If I have a string '1\n' > that I've read from some source and I really intend on i

Re: Line graphics on Linux console

2005-01-31 Thread Frank Millman
Frank Millman wrote: > Hi all > > The following is a message I sent to co.os.linux.setup - > > "My question concerns line graphics on a text-based console. ­My > actual problem relates to a [Python] program I have written using > ncurses, b­ut you can easily test it

Python 2.4 binaries for accessing PostgreSQL from Windows?

2005-02-04 Thread Frank Millman
have been using. It does not have one for 2.4. I tried the psycopg site, but it does not seem to have binaries at all. Does anyone know if either of these will be available in binary form for Python 2.4 on Windows? Thanks Frank Millman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4 binaries for accessing PostgreSQL from Windows?

2005-02-06 Thread Frank Millman
Frank Millman wrote: > Hi all > > The subject line says it all. > > I have been using pypgsql to access PostgreSQL from Linux and from > Windows, and it works fine. > > I am upgrading to Python 2.4. I can recompile pypgsql for Linux, but I > do not have a Windows

[OT] Problems with permissions etc

2005-07-27 Thread Frank Millman
se kinds of issues. Is it just something that one learns the hard way? Any advice, especially pointers to reading matter that covers this topic, will be much appreciated. Thanks Frank Millman -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   >