Re: Correct traceback for multiline chain of method calling

2021-07-09 Thread Artem Komendantian
> That line is already there:

>#   File "/home/komendart/temp/script.py", line 6, in fail
># raise RuntimeError('fail')

Probably I should rewrite more concretely.
I have such traceback ending for python3.7
#   File "script.py", line 15, in main
# .fail(True)
#   File "script.py", line 6, in fail
# raise RuntimeError('fail')

It has the exact line of the failing method's call (line 15) and that is
what I want for fresh python in general.
Just the name of the method and place inside of it with error in the last
part of traceback is not enough because this method can occur in the chain
several times (like .fail in my simple example) and I want to get a line of
the exact call.

> Annoying, but it would provide the desired precision.
I agree with all parts of this sentence :) Well, I can live with such a
solution but it is really uncomfortable.

In python3.7 and lower (even in python2, lol) if a method was called with
some arguments traceback had a line corresponding to some argument of
needed call. This behaviour was suitable for me.

I can a bit formalize my suggestion to improve python tracebacks.
If we have code in one line like

(
(some complex construction of object with __call__)
(
some arguments
)
)

traceback should contain a line with opening brace before arguments (Now in
the last python traceback seems to contain the start of the called object's
construction)
The last line of called object's construction or first of arguments
enumerating is ok too, it doesn't really matter for me.

BTW it is not important for me but I can dream how this proposal can be
generalized. For example for failing index operations a[b] (error line must
be close to [ here) or for all binary operations (a + b fails => the error
line must be close to the line with plus operator).

Does it sound reasonable? Am I on the right mailing list for python
improvement suggestions? :)

--
Best wishes,
Artem Komendantian
komendantyan.ar...@gmail.com


сб, 10 июл. 2021 г. в 02:53, Cameron Simpson :

> On 09Jul2021 18:29, Артем Комендантян 
> wrote:
> >There is a code https://pastebin.com/0NLsHuLa.
> >It has a multiline chain of method calling, when some method fails. In
> >python3.7 it fails in a row which corresponds to the failing method, in
> >python3.9 it corresponds to the very first line.
> >
> >Another similar example is https://pastebin.com/2P9snnMn
> >The error is on the first line for older pythons too.
>
> Interesting.
>
> There was some work done in recent Pythons to improve syntax error
> reporting. I wonder if it has had side effects on the reporting.
>
> >I propose to have a line with the method name in traceback if this
> >method
> >fails.
>
> That line is already there:
>
> #   File "/home/komendart/temp/script.py", line 6, in fail
> # raise RuntimeError('fail')
>
> See that it points at the fail() method from line 6 of the script?
>
> >I develop some library when it is very popular among users to declare some
> >operations with such multiline chains. Also I want to keep correct
> >traceback for each operation because the first line is not very
> informative
> >when some method occurred more than once in this chain.
> >
> >Can this improvement be done? Maybe anybody has any other suggestions on
> >how to get the correct line in traceback right now?
>
> Aside from putting the whole thing on 1 line? Joking.
>
> Possibly only by breaking it up purely while debugging:
>
> x = a.do_nothing()
> x = x.do_nothing()
> x = x.fail(True)
>
> and so forth. Annoying, but it would providethe desired precision.
>
> Cheers,
> Cameron Simpson 
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


makepy generates empty file

2005-04-08 Thread artem . marchenko
Hi

I am trying to use makepy to generate wrappers from *.tlb for examples
for GoogleDesktopSearch SDK
(http://desktop.google.com/downloadsdksubmit). However makepy generates
only very short __init__.py and no other files.
Unfortunately, I am quite new both to Python and COM and can hardly
guess what's wrong :(
Please, help.

Here is the contents of the generated __init__.py if it helps:

# -*- coding: mbcs -*-
# Created by makepy.py version 0.4.92
# By python version 2.4 (#60, Feb  9 2005, 19:03:27) [MSC v.1310 32 bit
(Intel)]
# From type library 'GoogleDesktopComponentSample1.dll'
# On Sat Apr 09 01:48:14 2005
"""GoogleDesktopComponentSample1 1.0 Type Library"""
makepy_version = '0.4.92'
python_version = 0x20400f0

import win32com.client.CLSIDToClass, pythoncom
import win32com.client.util
from pywintypes import IID
from win32com.client import Dispatch

# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing and pythoncom.Empty
defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

CLSID = IID('{3921D68F-6B14-4189-BA5D-2117A9DE67B6}')
MajorVersion = 1
MinorVersion = 0
LibraryFlags = 8
LCID = 0x0

RecordMap = {
}

CLSIDToClassMap = {}
CLSIDToPackageMap = {
'{95DA1281-AEB5-45A4-A71A-B2E57EA41E0F}' : 'IndexShortcut',
'{452FE2BF-D9C4-43FD-9137-78AE170C3EB3}' : 'IIndexShortcut',
}
VTablesToClassMap = {}
VTablesToPackageMap = {
'{452FE2BF-D9C4-43FD-9137-78AE170C3EB3}' : 'IIndexShortcut',
}


NamesToIIDMap = {
'IIndexShortcut' : '{452FE2BF-D9C4-43FD-9137-78AE170C3EB3}',
}

-- 
http://mail.python.org/mailman/listinfo/python-list