From william.belr at gmail.com Tue Aug 3 09:01:44 2021 From: william.belr at gmail.com (William Belanger) Date: Tue, 3 Aug 2021 09:01:44 -0400 Subject: [python-win32] COM: Minimal example of a custom server working with DispatchWithEvents() In-Reply-To: References: <5d219ceb-928c-b5e6-5659-db8e96cde856@gmail.com> Message-ID: That works, thank you. I'm relieved to finally move forward with this. Revised example; #!/usr/bin/python3 > # https://gitlab.com/-/snippets/2155778 > > import pythoncom > import sys > import threading > import win32com.client > import win32com.server.util > from win32com.server import localserver > > > class EventHandler: > _public_methods_ = ["ping"] > > def __init__(self): > self.server = win32com.client.Dispatch("Minimal.Example") > self.server.setParent(win32com.server.util.wrap(self)) > self.server.Ping() # ## > > def ping(self): > print("pong") > > > class ServerAdapter: > _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER > _reg_clsid_ = "{D390AE78-D6A2-47CF-B462-E4F2DC9C70F5}" > _reg_progid_ = "Minimal.Example" > _reg_verprogid_ = "Minimal.Example.1" > _reg_class_spec_ = "MinimalExample.ServerAdapter" > _public_attrs_ = ["parent"] > _public_methods_ = ["setParent", "Ping"] > > def setParent(self, parent): > self.parent = win32com.client.Dispatch(parent) > > def Ping(self): > self.parent.ping() > > > def server_init(): > pythoncom.CoInitialize() > localserver.serve(["{D390AE78-D6A2-47CF-B462-E4F2DC9C70F5}"]) > > > if __name__ == "__main__": > if "--register" in sys.argv[1:] or "--unregister" in sys.argv[1:]: > import win32com.server.register > win32com.server.register.UseCommandLine(ServerAdapter) > else: > server_thread = threading.Thread(target=server_init) > server_thread.start() > EventHandler() > Best, Will Le sam. 31 juil. 2021 ? 21:36, Mark Hammond a ?crit : > > On 1/08/2021 12:21 am, William Belanger wrote: > > Hi, > > > > > > Thank you for the follow up. Perhaps I did not express my need clearly > > enough, so I made this minimal example; > > > > > > # https://gitlab.com/-/snippets/2155778 > > > > > > import pythoncom > > import sys > > import threading > > import win32com.client > > import win32com.server.util > > from win32com.server import localserver > > > > > > def init_server(): > > pythoncom.CoInitialize() > > localserver.serve(["{D390AE78-D6A2-47CF-B462-E4F2DC9C70F5}"]) > > > > > > class Main: > > def __init__(self): > > self.server = win32com.client.Dispatch("Minimal.Example") > > self.server.parent = self # TypeError: must be real number, not Main > > That exception is very odd and I should look into it - but the problem > here is that you are trying to set an attribute on a COM object which is > a Python instance, which doesn't really make sense. What you want is to > set it to a COM object - which `self` is not. So something like: > > > class Main: > _public_methods_ = ["pong"] > def __init__(self): > self.server = win32com.client.Dispatch("Minimal.Example") > self.server.parent = win32com.server.util.wrap(self) > self.server.Ping() > > def pong(self): > return "pong" > > works. Sadly another paper-cut here is that the server just sees this as > a plain IDispatch object rather than a `Dispatch` wrapper - so `Ping` > needs to look something like: > > def Ping(self): > parent_as_object = win32com.client.Dispatch(self.parent) > print(parent_as_object.pong()) > > I guess you could, say, change `parent` into `set_parent()`, or > intercept via __setattr__() and do the wrapping just once. > > HTH, > > Mark > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mriswithe at gmail.com Wed Aug 11 19:33:14 2021 From: mriswithe at gmail.com (Mriswithe) Date: Wed, 11 Aug 2021 18:33:14 -0500 Subject: [python-win32] windows images on clipboard Message-ID: I was looking at making a little helper app for Windows that will take an image on your clipboard and ensure it is under 8MB for posting to discord, and if it isn't, use Pillow to resize it until it is the right size. I can use Pillow's ImageGrab.grabclipboard() to get the image off the clipboard, but I am a little confused about writing it back. I have been back and forth between the pywin32 source and the windows docs for the windows C API, but I don't have any previous experience or context to know what some pieces are intended to do. I found an example to write to it from StackOverflow ( https://stackoverflow.com/questions/34322132/copy-image-to-clipboard), but I was wanting to dig a little deeper to see what formats other than BMP I could use to put on the clipboard. My ignorance of C++ and the Windows APIs and hell the Python C API is really biting me here. Is there a bit of an idiots example guide for how to say, put a PNG on the clipboard or a JPG? Some example code? There is a ton of useful info in the pywin32 repo, but I haven't found anything that has made this click for me. Thanks for any help! Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Aug 12 12:46:33 2021 From: timr at probo.com (Tim Roberts) Date: Thu, 12 Aug 2021 09:46:33 -0700 Subject: [python-win32] windows images on clipboard In-Reply-To: References: Message-ID: <891133df-fec2-5228-f46a-ec5f7fd846a8@probo.com> Mriswithe wrote: > > I was looking at making a little helper app for Windows that will take > an image on your clipboard and ensure it is under 8MB for posting to > discord, and if it isn't, use Pillow to resize it until it is the > right size. > > I can use Pillow's ImageGrab.grabclipboard() to get the image off the > clipboard, but I am a little confused about writing it back. I have > been back and forth between the pywin32 source and the windows docs > for the windows C API, but I don't have any previous experience or > context to know what some pieces are intended to do. > > I found an example to write to it from StackOverflow > (https://stackoverflow.com/questions/34322132/copy-image-to-clipboard > ), > but I was wanting to dig a little deeper to see what formats other > than BMP I could use to put on the clipboard. My ignorance of C++ and > the Windows APIs and hell the Python C API is really biting me here. You can't.? You have to write it as a DIB (Device Independent Bitmap), which is the format in a .BMP file. The Windows clipboard was designed in roughly 1986, before GIF, before JPEG and way, way before PNG.? The clipboard is designed for universal interchange, so it really does need to spec the lowest common denominator.? If they allowed PNGs, then all of the graphics application in the world would have to be modified to decode PNG data. So, to make your app work, save the result as a BMP. > Is there a bit of an idiots example guide for how to say, put a PNG on > the clipboard or a JPG? Some example code? There is a ton of useful > info in the pywin32 repo, but I haven't found anything that has made > this click for me. There is no idiots guide, because it cannot be done.? Well, technically speaking you can put arbitrary binary data into the clipboard, but other graphics applications will not be able to read it.? When they look for image data, they look for format CF_DIB, and that means a .BMP. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3389 bytes Desc: S/MIME Cryptographic Signature URL: From salih.kuyumcu at agu.edu.tr Thu Aug 12 05:17:25 2021 From: salih.kuyumcu at agu.edu.tr (Salih KUYUMCU) Date: Thu, 12 Aug 2021 12:17:25 +0300 Subject: [python-win32] Pywin32 local variable Message-ID: Hello dear authorized, I'm Salih from Abdullah G?l Univercity from Turkey. Now I'm tring to make a project with python and abap. I'm now using the pywin32 for com server in windows. I can send some variables to python from abap and get them. However, I have a problem with local variables. I create a String value before the methods and try to return these values in another method. I get the problem local variable 'xxx' referenced before assignment. I just want to take or change a variable that is not in the method. Please help me for this topic. If you want I can make more explanations. I used Stefan Schnell's page in SAP community. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wlfraed at ix.netcom.com Thu Aug 12 11:57:05 2021 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Thu, 12 Aug 2021 11:57:05 -0400 Subject: [python-win32] windows images on clipboard References: Message-ID: On Wed, 11 Aug 2021 18:33:14 -0500, Mriswithe declaimed the following: > >Is there a bit of an idiots example guide for how to say, put a PNG on the >clipboard or a JPG? Some example code? There is a ton of useful info in the >pywin32 repo, but I haven't found anything that has made this click for me. > From a quick browse in Google -- IMAGES are only in one of the Windows bitmap formats when on the clipboard; ie, they've been "rendered" to a bitmap memory structure. PNG or JPG -- those are file formats, not rendered images. There does appear to be a CF_TIFF format. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ From mriswithe at gmail.com Thu Aug 12 13:08:53 2021 From: mriswithe at gmail.com (Mriswithe) Date: Thu, 12 Aug 2021 12:08:53 -0500 Subject: [python-win32] windows images on clipboard In-Reply-To: <891133df-fec2-5228-f46a-ec5f7fd846a8@probo.com> References: <891133df-fec2-5228-f46a-ec5f7fd846a8@probo.com> Message-ID: Awesome, thank you so much for that info. That makes my tail chasing make more sense! Thanks for saving me from additional posterior extension pursuit. Last question I think, how do I put a file path reference on the clipboard similar to in explorer selecting a few files and hitting control c ? I think I had tested that with discord and it worked, but not 100% on that. On Thu, Aug 12, 2021, 11:57 AM Tim Roberts wrote: > Mriswithe wrote: > > > > I was looking at making a little helper app for Windows that will take > > an image on your clipboard and ensure it is under 8MB for posting to > > discord, and if it isn't, use Pillow to resize it until it is the > > right size. > > > > I can use Pillow's ImageGrab.grabclipboard() to get the image off the > > clipboard, but I am a little confused about writing it back. I have > > been back and forth between the pywin32 source and the windows docs > > for the windows C API, but I don't have any previous experience or > > context to know what some pieces are intended to do. > > > > I found an example to write to it from StackOverflow > > (https://stackoverflow.com/questions/34322132/copy-image-to-clipboard > > ), > > > but I was wanting to dig a little deeper to see what formats other > > than BMP I could use to put on the clipboard. My ignorance of C++ and > > the Windows APIs and hell the Python C API is really biting me here. > > You can't. You have to write it as a DIB (Device Independent Bitmap), > which is the format in a .BMP file. > > The Windows clipboard was designed in roughly 1986, before GIF, before > JPEG and way, way before PNG. The clipboard is designed for universal > interchange, so it really does need to spec the lowest common > denominator. If they allowed PNGs, then all of the graphics application > in the world would have to be modified to decode PNG data. > > So, to make your app work, save the result as a BMP. > > > > Is there a bit of an idiots example guide for how to say, put a PNG on > > the clipboard or a JPG? Some example code? There is a ton of useful > > info in the pywin32 repo, but I haven't found anything that has made > > this click for me. > > There is no idiots guide, because it cannot be done. Well, technically > speaking you can put arbitrary binary data into the clipboard, but other > graphics applications will not be able to read it. When they look for > image data, they look for format CF_DIB, and that means a .BMP. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Fri Aug 13 02:19:31 2021 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 13 Aug 2021 18:19:31 +1200 Subject: [python-win32] Pywin32 local variable In-Reply-To: References: Message-ID: <2de75be7-5c87-3bb9-1409-ac71b1af1297@canterbury.ac.nz> On 12/08/21 9:17 pm, Salih KUYUMCU via python-win32 wrote: > I create a String > value before the methods and try to return these values in another > method. I get the problem local variable 'xxx' referenced before > assignment. It sounds like you may want to store the value in an attribute of an object instead of a local variable. If you show us your code and the exact error message you're getting, we will be able to help you better. -- Greg From jacob at blindza.co.za Fri Aug 13 02:49:25 2021 From: jacob at blindza.co.za (Jacob Kruger) Date: Fri, 13 Aug 2021 08:49:25 +0200 Subject: [python-win32] Debugging python with something like VS code, when working with flask web framework Message-ID: <15b6025f95e1c1b3bc82a5ec91e81b92.squirrel@c-true.co.za> Hi there I am specifically trying to sort out debugging code and processes when working with the flask web development framework, while working with VS code insiders. Now, following things like the following steps, but, specifically using an external terminal, I can get it to pause on breakpoints, etc. when executing normal code, but, when trying to run it against the flask module process, it seems to just execute the code and not manage to attach to the execution processes, etc.? Python and flask tutorial in VS code: https://code.visualstudio.com/docs/python/tutorial-flask Or, the more generic debugging implementation tutorial - Getting started tutorial for python and VS code: https://code.visualstudio.com/docs/python/python-tutorial#_configure-and-run-the-debugger This is on a windows 10 64 bit pro machine, and, just want to know if anyone has suggestions with regards to implementing debugging when working with web development frameworks like flask, pyramid, etc.? TIA Jacob Kruger +2782 413 4791 Skype: BlindZA "Resistance is futile...but, acceptance is versatile..." "...resistance is futile...but, acceptance is versatile..." From jacob at blindza.co.za Fri Aug 13 02:41:03 2021 From: jacob at blindza.co.za (jacob kruger) Date: Fri, 13 Aug 2021 08:41:03 +0200 Subject: [python-win32] Debugging python with something like VS code, when working with flask web framework Message-ID: <1b14faee-2d1e-5958-7a8c-621d6a6902d0@blindza.co.za> Hi there I am specifically trying to sort out debugging code and processes when working with the flask web development framework, while working with VS code insiders. Now, following things like the following steps, but, specifically using an external terminal, I can get it to pause on breakpoints, etc. when executing normal code, but, when trying to run it against the flask module process, it seems to just execute the code and not manage to attach to the execution processes, etc.? Python and flask tutorial in VS code: https://code.visualstudio.com/docs/python/tutorial-flask Or, the more generic debugging implementation tutorial: Getting started tutorial for python and VS code: https://code.visualstudio.com/docs/python/python-tutorial#_configure-and-run-the-debugger This is working on a windows 10 64 bit pro machine, and, just want to know if anyone has suggestions with regards to implementing debugging when working with web development frameworks like flask, pyramid, etc.? TIA Jacob Kruger +2782 413 4791 Skype: BlindZA "Resistance is futile...but, acceptance is versatile..." "...resistance is futile...but, acceptance is versatile..." From Vadim.Konovalov at dell.com Fri Aug 13 03:55:48 2021 From: Vadim.Konovalov at dell.com (Konovalov, Vadim) Date: Fri, 13 Aug 2021 07:55:48 +0000 Subject: [python-win32] windows images on clipboard In-Reply-To: References: <891133df-fec2-5228-f46a-ec5f7fd846a8@probo.com> Message-ID: Here is the better tcl/tk version of script which then could be reused with tkinter to solve the task # # rotate image in clipboard # # TBD - user-friendly - message box if no image in clipboard, also - "ready" message # # most code from here - http://wiki.tcl.tk/15647 # package require Tk package require img::bmp package require base64 package require twapi #twapi::open_clipboard #foreach {i} [twapi::get_clipboard_formats] { # puts "$i" # # [twapi::get_registered_clipboard_format_name $i] #} #twapi::close_clipboard # Copy the contents of the Windows clipboard into a photo image. # Return the photo image identifier. proc Clipboard2Img {} { twapi::open_clipboard # Assume clipboard content is in format 8 (CF_DIB) set retVal [catch {twapi::read_clipboard 8} clipData] if { $retVal != 0 } { error "Invalid or no content in clipboard" } # First parse the bitmap data to collect header information binary scan $clipData "iiissiiiiii" \ size width height planes bitcount compression sizeimage \ xpelspermeter ypelspermeter clrused clrimportant # We only handle BITMAPINFOHEADER right now (size must be 40) if {$size != 40} { error "Unsupported bitmap format. Header size=$size" } # We need to figure out the offset to the actual bitmap data # from the start of the file header. For this we need to know the # size of the color table which directly follows the BITMAPINFOHEADER if {$bitcount == 0} { error "Unsupported format: implicit JPEG or PNG" } elseif {$bitcount == 1} { set color_table_size 2 } elseif {$bitcount == 4} { # TBD - Not sure if this is the size or the max size set color_table_size 16 } elseif {$bitcount == 8} { # TBD - Not sure if this is the size or the max size set color_table_size 256 } elseif {$bitcount == 16 || $bitcount == 32} { if {$compression == 0} { # BI_RGB set color_table_size $clrused } elseif {$compression == 3} { # BI_BITFIELDS set color_table_size 3 } else { error "Unsupported compression type '$compression' for bitcount value $bitcount" } } elseif {$bitcount == 24} { set color_table_size $clrused } else { error "Unsupported value '$bitcount' in bitmap bitcount field" } set phImg [image create photo] set filehdr_size 14 ; # sizeof(BITMAPFILEHEADER) set bitmap_file_offset [expr {$filehdr_size+$size+($color_table_size*4)}] set filehdr [binary format "a2 i x2 x2 i" \ "BM" [expr {$filehdr_size + [string length $clipData]}] \ $bitmap_file_offset] append filehdr $clipData $phImg put $filehdr -format bmp twapi::close_clipboard return $phImg } # Copy photo image "phImg" into Windows clipboard. proc Img2Clipboard { phImg } { # First 14 bytes are bitmapfileheader - get rid of this set data [string range [base64::decode [$phImg data -format bmp]] 14 end] twapi::open_clipboard twapi::empty_clipboard twapi::write_clipboard 8 $data twapi::close_clipboard } proc rotate { phImg angle } { set w [image width $phImg] set h [image height $phImg] switch -- $angle { 180 { set tmp [image create photo -width $w -height $h] $tmp copy $phImg -subsample -1 -1 return $tmp } 270 - 90 - -90 { set tmp [image create photo -width $h -height $w] set matrix [string repeat "{[string repeat {0 } $h]} " $w] if { $angle == -90 || $angle == 270 } { set x0 0; set y [expr {$h-1}]; set dx 1; set dy -1 } else { set x0 [expr {$w-1}]; set y 0; set dx -1; set dy 1 } foreach row [$phImg data] { set x $x0 foreach pixel $row { lset matrix $x $y $pixel incr x $dx } incr y $dy } $tmp put $matrix return $tmp } default { error "Invalid angle $angle specified" } } } Img2Clipboard [rotate [Clipboard2Img] [lindex $argv 0]] destroy . Internal Use - Confidential From: Konovalov, Vadim Sent: Friday, August 13, 2021 10:36 AM To: Mriswithe; Tim Roberts Cc: python-win32 at python.org Subject: RE: [python-win32] windows images on clipboard There are 2 ways to solve this task, actually. 1st way is a bit more difficult but more efficient. Read https://docs.microsoft.com/en-us/windows/win32/dataxchg/using-the-clipboard#copying-information-to-the-clipboard and implement this in python module. This was done for perl and worked for me in Win32::Clipboard module https://github.com/jandubois/win32-clipboard/pull/5 At least worked for me (I haven?t rechecked but I am 95% sure it worked, I wrote perl script which rotates image in windows clipboard and placed rotated image back. 2nd way does not require C coding and deep delving into clipboard documentation Tcl/Tk can do this. You can use tcl/tk code from python with tkinter. Below is my tcl/tk script which you can adjust and enjoy. Its not cleaned-up, sorry, but it works. # # version 0.30 # 0.21 23mar2012: "lowercase" button # 0.22 03apr2012: fix table # 0.23 17apr2012: '?'/. # 0.24 27apr2012: smaller button but tooltip! :), also return to prev.application (SetForegroundWindow) # 0.25 04jun2012: Ctrl+lowercase button - UPCASE # ?????->????? is 4rd and not initially seen # 0.30 - rewrite in tcl/tk, with "twapi" usage # # TODO: automatically invoke copy-paste, # TODO: Ctrl+Click=1st letter upcased, # TODO: very compact mode, bigger on mouse move # TODO: crop-image function, and view-clipboard (because it is the same) # # TODO - Clipboard2Img - to outer lib file! # #puts [encoding names] #encoding system utf-8 set er ?????????????????????????????????????????????????????????????????? set el "FZf,dult`;pbqrkvyjghcnea\[wxio\]sm'.z?" set ee "???????????????????????????????????????????????????????????????????" package require Tk package require Ttk package require img::bmp package require base64 package require twapi package require tooltip ttk::style theme use alt # winnative clam alt default classic xpnative wm title . {????? clipboard} wm attributes . -topmost 1 -toolwindow 1 wm geometry . 130x56 place [ttk::button .b1 -text {Ntrcn->?????} -command lat2cyr] -y 0 -x 0 -height 20 -width 110 place [ttk::button .b2 -text {????->Text} -command cyr2lat] -y 20 -x 0 -height 20 -width 110 place [ttk::button .b4 -text {TEXT?????->text?????} -command lowercase] -y 40 -x 0 -height 20 -relwidth 1 place [ttk::button .b3 -text {?????->?????} -command eur2cyr] -y 60 -x 0 -height 20 -relwidth 1 image create photo rotate_ccw -data R0lGODlhEAAQAIIAAPwCBAQCBFxaXIQChEQCBAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAM0CLrcHjA6JcK4ET68MrNDoIgjOYbdJ4IXagIa3IqVFAMEOqpfn067ErBxG0qGsCJyyQT4EwAh/mhDcmVhdGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29yLmNvbQA7 image create photo rotate_cw -data R0lGODlhEAAQAIIAAPwCBAQCBIQChFxaXEQCBAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAMzCLrcHjA6FaG4YbS6At5BR31UKI4mADGhd31rpbmCuZ6qQLA8XvqT2+QhHLKKxqSy4U8AACH+aENyZWF0ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29yIDE5OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cuZGV2ZWxjb3IuY29tADs= place [ttk::button .b5 -image rotate_cw -command {Img2Clipboard [rotate [Clipboard2Img] -90]}] -y 0 -x 108 -height 20 -width 22 place [ttk::button .b6 -image rotate_ccw -command {Img2Clipboard [rotate [Clipboard2Img] 90]}] -y 20 -x 108 -height 20 -width 22 tooltip::tooltip .b1 {Ntrcn->?????} tooltip::tooltip .b2 {????->Text} tooltip::tooltip .b3 {?????->?????} tooltip::tooltip .b4 {TEXT?????->text?????; [Ctrl]+click - UPCASE (TEXT?????->TEXT?????)} tooltip::tooltip .b5 {rotate clockwise IMAGE that is in clipboard} tooltip::tooltip .b5 {rotate counter-clockwise IMAGE that is in clipboard} #bind . perl::mmotion bind .b4 uppercase proc lat2cyr {} { before_get global el er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $el] if {$i != -1} { set s [string replace "$s" $x $x [string index $er $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard after_put } proc cyr2lat {} { before_get global el er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $er] if {$i != -1} { set s [string replace "$s" $x $x [string index $el $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard after_put } proc eur2cyr {} { global ee er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $ee] if {$i != -1} { set s [string replace "$s" $x $x [string index $er $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard } set skip 0 proc lowercase {} { global skip if {$skip != 0} { set skip 0 return } before_get twapi::open_clipboard set s [twapi::read_clipboard_text] twapi::empty_clipboard twapi::write_clipboard_text [string tolower "$s"] twapi::close_clipboard after_put } proc uppercase {} { before_get twapi::open_clipboard set s [twapi::read_clipboard_text] twapi::empty_clipboard twapi::write_clipboard_text [string toupper "$s"] twapi::close_clipboard set skip 1 after_put } # Copy the contents of the Windows clipboard into a photo image. # Return the photo image identifier. proc Clipboard2Img {} { twapi::open_clipboard # Assume clipboard content is in format 8 (CF_DIB) set retVal [catch {twapi::read_clipboard 8} clipData] if { $retVal != 0 } { error "Invalid or no content in clipboard" } # First parse the bitmap data to collect header information binary scan $clipData "iiissiiiiii" \ size width height planes bitcount compression sizeimage \ xpelspermeter ypelspermeter clrused clrimportant # We only handle BITMAPINFOHEADER right now (size must be 40) if {$size != 40} { error "Unsupported bitmap format. Header size=$size" } # We need to figure out the offset to the actual bitmap data # from the start of the file header. For this we need to know the # size of the color table which directly follows the BITMAPINFOHEADER if {$bitcount == 0} { error "Unsupported format: implicit JPEG or PNG" } elseif {$bitcount == 1} { set color_table_size 2 } elseif {$bitcount == 4} { # TBD - Not sure if this is the size or the max size set color_table_size 16 } elseif {$bitcount == 8} { # TBD - Not sure if this is the size or the max size set color_table_size 256 } elseif {$bitcount == 16 || $bitcount == 32} { if {$compression == 0} { # BI_RGB set color_table_size $clrused } elseif {$compression == 3} { # BI_BITFIELDS set color_table_size 3 } else { error "Unsupported compression type '$compression' for bitcount value $bitcount" } } elseif {$bitcount == 24} { set color_table_size $clrused } else { error "Unsupported value '$bitcount' in bitmap bitcount field" } set phImg [image create photo] set filehdr_size 14 ; # sizeof(BITMAPFILEHEADER) set bitmap_file_offset [expr {$filehdr_size+$size+($color_table_size*4)}] set filehdr [binary format "a2 i x2 x2 i" \ "BM" [expr {$filehdr_size + [string length $clipData]}] \ $bitmap_file_offset] append filehdr $clipData $phImg put $filehdr -format bmp twapi::close_clipboard return $phImg } # Copy photo image "phImg" into Windows clipboard. proc Img2Clipboard { phImg } { # First 14 bytes are bitmapfileheader - get rid of this set data [string range [base64::decode [$phImg data -format bmp]] 14 end] twapi::open_clipboard twapi::empty_clipboard twapi::write_clipboard 8 $data twapi::close_clipboard } proc rotate { phImg angle } { set w [image width $phImg] set h [image height $phImg] switch -- $angle { 180 { set tmp [image create photo -width $w -height $h] $tmp copy $phImg -subsample -1 -1 return $tmp } 270 - 90 - -90 { set tmp [image create photo -width $h -height $w] set matrix [string repeat "{[string repeat {0 } $h]} " $w] if { $angle == -90 || $angle == 270 } { set x0 0; set y [expr {$h-1}]; set dx 1; set dy -1 } else { set x0 [expr {$w-1}]; set y 0; set dx -1; set dy 1 } foreach row [$phImg data] { set x $x0 foreach pixel $row { lset matrix $x $y $pixel incr x $dx } incr y $dy } $tmp put $matrix return $tmp } default { error "Invalid angle $angle specified" } } } set fhwnd 0 #proc tcl::mmotion {} {$fhwnd = Win32::GuiTest::GetForegroundWindow} proc before_get {} { #Win32::GuiTest::SendKeys("%{TAB}{PAUSE 100}^{C}"); #???? ?? ???????? :( #$fhwnd = Win32::GuiTest::GetForegroundWindow; global fhwnd set fhwnd [twapi::get_foreground_window] } proc after_put {} { global fhwnd twapi::set_foreground_window $fhwnd # #Win32::GuiTest::SendKeys("%{TAB}"); # #Win32::GuiTest::SendKeys("^{V}"); # #Win32::GuiTest::SendMessage($fhwnd,0x100,VK_HOME,0); # #Win32::GuiTest::SendMessage($fhwnd,0x100,VK_SHIFT,0); # #???? ?? ???????? :( } From: python-win32 > On Behalf Of Mriswithe Sent: Thursday, August 12, 2021 8:09 PM To: Tim Roberts Cc: python-win32 at python.org Subject: Re: [python-win32] windows images on clipboard Awesome, thank you so much for that info. That makes my tail chasing make more sense! Thanks for saving me from additional posterior extension pursuit. Last question I think, how do I put a file path reference on the clipboard similar to in explorer selecting a few files and hitting control c ? I think I had tested that with discord and it worked, but not 100% on that. On Thu, Aug 12, 2021, 11:57 AM Tim Roberts > wrote: Mriswithe wrote: > > I was looking at making a little helper app for Windows that will take > an image on your clipboard and ensure it is under 8MB for posting to > discord, and if it isn't, use Pillow to resize it until it is the > right size. > > I can use Pillow's ImageGrab.grabclipboard() to get the image off the > clipboard, but I am a little confused about writing it back. I have > been back and forth between the pywin32 source and the windows docs > for the windows C API, but I don't have any previous experience or > context to know what some pieces are intended to do. > > I found an example to write to it from StackOverflow > (https://stackoverflow.com/questions/34322132/copy-image-to-clipboard [stackoverflow.com] > >), > but I was wanting to dig a little deeper to see what formats other > than BMP I could use to put on the clipboard. My ignorance of C++ and > the Windows APIs and hell the Python C API is really biting me here. You can't. You have to write it as a DIB (Device Independent Bitmap), which is the format in a .BMP file. The Windows clipboard was designed in roughly 1986, before GIF, before JPEG and way, way before PNG. The clipboard is designed for universal interchange, so it really does need to spec the lowest common denominator. If they allowed PNGs, then all of the graphics application in the world would have to be modified to decode PNG data. So, to make your app work, save the result as a BMP. > Is there a bit of an idiots example guide for how to say, put a PNG on > the clipboard or a JPG? Some example code? There is a ton of useful > info in the pywin32 repo, but I haven't found anything that has made > this click for me. There is no idiots guide, because it cannot be done. Well, technically speaking you can put arbitrary binary data into the clipboard, but other graphics applications will not be able to read it. When they look for image data, they look for format CF_DIB, and that means a .BMP. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 [mail.python.org] Internal Use - Confidential -------------- next part -------------- An HTML attachment was scrubbed... URL: From Vadim.Konovalov at dell.com Fri Aug 13 03:35:30 2021 From: Vadim.Konovalov at dell.com (Konovalov, Vadim) Date: Fri, 13 Aug 2021 07:35:30 +0000 Subject: [python-win32] windows images on clipboard In-Reply-To: References: <891133df-fec2-5228-f46a-ec5f7fd846a8@probo.com> Message-ID: There are 2 ways to solve this task, actually. 1st way is a bit more difficult but more efficient. Read https://docs.microsoft.com/en-us/windows/win32/dataxchg/using-the-clipboard#copying-information-to-the-clipboard and implement this in python module. This was done for perl and worked for me in Win32::Clipboard module https://github.com/jandubois/win32-clipboard/pull/5 At least worked for me (I haven?t rechecked but I am 95% sure it worked, I wrote perl script which rotates image in windows clipboard and placed rotated image back. 2nd way does not require C coding and deep delving into clipboard documentation Tcl/Tk can do this. You can use tcl/tk code from python with tkinter. Below is my tcl/tk script which you can adjust and enjoy. Its not cleaned-up, sorry, but it works. # # version 0.30 # 0.21 23mar2012: "lowercase" button # 0.22 03apr2012: fix table # 0.23 17apr2012: '?'/. # 0.24 27apr2012: smaller button but tooltip! :), also return to prev.application (SetForegroundWindow) # 0.25 04jun2012: Ctrl+lowercase button - UPCASE # ?????->????? is 4rd and not initially seen # 0.30 - rewrite in tcl/tk, with "twapi" usage # # TODO: automatically invoke copy-paste, # TODO: Ctrl+Click=1st letter upcased, # TODO: very compact mode, bigger on mouse move # TODO: crop-image function, and view-clipboard (because it is the same) # # TODO - Clipboard2Img - to outer lib file! # #puts [encoding names] #encoding system utf-8 set er ?????????????????????????????????????????????????????????????????? set el "FZf,dult`;pbqrkvyjghcnea\[wxio\]sm'.z?" set ee "???????????????????????????????????????????????????????????????????" package require Tk package require Ttk package require img::bmp package require base64 package require twapi package require tooltip ttk::style theme use alt # winnative clam alt default classic xpnative wm title . {????? clipboard} wm attributes . -topmost 1 -toolwindow 1 wm geometry . 130x56 place [ttk::button .b1 -text {Ntrcn->?????} -command lat2cyr] -y 0 -x 0 -height 20 -width 110 place [ttk::button .b2 -text {????->Text} -command cyr2lat] -y 20 -x 0 -height 20 -width 110 place [ttk::button .b4 -text {TEXT?????->text?????} -command lowercase] -y 40 -x 0 -height 20 -relwidth 1 place [ttk::button .b3 -text {?????->?????} -command eur2cyr] -y 60 -x 0 -height 20 -relwidth 1 image create photo rotate_ccw -data R0lGODlhEAAQAIIAAPwCBAQCBFxaXIQChEQCBAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAM0CLrcHjA6JcK4ET68MrNDoIgjOYbdJ4IXagIa3IqVFAMEOqpfn067ErBxG0qGsCJyyQT4EwAh/mhDcmVhdGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29yLmNvbQA7 image create photo rotate_cw -data R0lGODlhEAAQAIIAAPwCBAQCBIQChFxaXEQCBAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAMzCLrcHjA6FaG4YbS6At5BR31UKI4mADGhd31rpbmCuZ6qQLA8XvqT2+QhHLKKxqSy4U8AACH+aENyZWF0ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29yIDE5OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cuZGV2ZWxjb3IuY29tADs= place [ttk::button .b5 -image rotate_cw -command {Img2Clipboard [rotate [Clipboard2Img] -90]}] -y 0 -x 108 -height 20 -width 22 place [ttk::button .b6 -image rotate_ccw -command {Img2Clipboard [rotate [Clipboard2Img] 90]}] -y 20 -x 108 -height 20 -width 22 tooltip::tooltip .b1 {Ntrcn->?????} tooltip::tooltip .b2 {????->Text} tooltip::tooltip .b3 {?????->?????} tooltip::tooltip .b4 {TEXT?????->text?????; [Ctrl]+click - UPCASE (TEXT?????->TEXT?????)} tooltip::tooltip .b5 {rotate clockwise IMAGE that is in clipboard} tooltip::tooltip .b5 {rotate counter-clockwise IMAGE that is in clipboard} #bind . perl::mmotion bind .b4 uppercase proc lat2cyr {} { before_get global el er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $el] if {$i != -1} { set s [string replace "$s" $x $x [string index $er $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard after_put } proc cyr2lat {} { before_get global el er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $er] if {$i != -1} { set s [string replace "$s" $x $x [string index $el $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard after_put } proc eur2cyr {} { global ee er twapi::open_clipboard set s [twapi::read_clipboard_text] set x 0 foreach letter [split $s {}] { set i [string first $letter $ee] if {$i != -1} { set s [string replace "$s" $x $x [string index $er $i]] } incr x } twapi::empty_clipboard twapi::write_clipboard_text "$s" twapi::close_clipboard } set skip 0 proc lowercase {} { global skip if {$skip != 0} { set skip 0 return } before_get twapi::open_clipboard set s [twapi::read_clipboard_text] twapi::empty_clipboard twapi::write_clipboard_text [string tolower "$s"] twapi::close_clipboard after_put } proc uppercase {} { before_get twapi::open_clipboard set s [twapi::read_clipboard_text] twapi::empty_clipboard twapi::write_clipboard_text [string toupper "$s"] twapi::close_clipboard set skip 1 after_put } # Copy the contents of the Windows clipboard into a photo image. # Return the photo image identifier. proc Clipboard2Img {} { twapi::open_clipboard # Assume clipboard content is in format 8 (CF_DIB) set retVal [catch {twapi::read_clipboard 8} clipData] if { $retVal != 0 } { error "Invalid or no content in clipboard" } # First parse the bitmap data to collect header information binary scan $clipData "iiissiiiiii" \ size width height planes bitcount compression sizeimage \ xpelspermeter ypelspermeter clrused clrimportant # We only handle BITMAPINFOHEADER right now (size must be 40) if {$size != 40} { error "Unsupported bitmap format. Header size=$size" } # We need to figure out the offset to the actual bitmap data # from the start of the file header. For this we need to know the # size of the color table which directly follows the BITMAPINFOHEADER if {$bitcount == 0} { error "Unsupported format: implicit JPEG or PNG" } elseif {$bitcount == 1} { set color_table_size 2 } elseif {$bitcount == 4} { # TBD - Not sure if this is the size or the max size set color_table_size 16 } elseif {$bitcount == 8} { # TBD - Not sure if this is the size or the max size set color_table_size 256 } elseif {$bitcount == 16 || $bitcount == 32} { if {$compression == 0} { # BI_RGB set color_table_size $clrused } elseif {$compression == 3} { # BI_BITFIELDS set color_table_size 3 } else { error "Unsupported compression type '$compression' for bitcount value $bitcount" } } elseif {$bitcount == 24} { set color_table_size $clrused } else { error "Unsupported value '$bitcount' in bitmap bitcount field" } set phImg [image create photo] set filehdr_size 14 ; # sizeof(BITMAPFILEHEADER) set bitmap_file_offset [expr {$filehdr_size+$size+($color_table_size*4)}] set filehdr [binary format "a2 i x2 x2 i" \ "BM" [expr {$filehdr_size + [string length $clipData]}] \ $bitmap_file_offset] append filehdr $clipData $phImg put $filehdr -format bmp twapi::close_clipboard return $phImg } # Copy photo image "phImg" into Windows clipboard. proc Img2Clipboard { phImg } { # First 14 bytes are bitmapfileheader - get rid of this set data [string range [base64::decode [$phImg data -format bmp]] 14 end] twapi::open_clipboard twapi::empty_clipboard twapi::write_clipboard 8 $data twapi::close_clipboard } proc rotate { phImg angle } { set w [image width $phImg] set h [image height $phImg] switch -- $angle { 180 { set tmp [image create photo -width $w -height $h] $tmp copy $phImg -subsample -1 -1 return $tmp } 270 - 90 - -90 { set tmp [image create photo -width $h -height $w] set matrix [string repeat "{[string repeat {0 } $h]} " $w] if { $angle == -90 || $angle == 270 } { set x0 0; set y [expr {$h-1}]; set dx 1; set dy -1 } else { set x0 [expr {$w-1}]; set y 0; set dx -1; set dy 1 } foreach row [$phImg data] { set x $x0 foreach pixel $row { lset matrix $x $y $pixel incr x $dx } incr y $dy } $tmp put $matrix return $tmp } default { error "Invalid angle $angle specified" } } } set fhwnd 0 #proc tcl::mmotion {} {$fhwnd = Win32::GuiTest::GetForegroundWindow} proc before_get {} { #Win32::GuiTest::SendKeys("%{TAB}{PAUSE 100}^{C}"); #???? ?? ???????? :( #$fhwnd = Win32::GuiTest::GetForegroundWindow; global fhwnd set fhwnd [twapi::get_foreground_window] } proc after_put {} { global fhwnd twapi::set_foreground_window $fhwnd # #Win32::GuiTest::SendKeys("%{TAB}"); # #Win32::GuiTest::SendKeys("^{V}"); # #Win32::GuiTest::SendMessage($fhwnd,0x100,VK_HOME,0); # #Win32::GuiTest::SendMessage($fhwnd,0x100,VK_SHIFT,0); # #???? ?? ???????? :( } From: python-win32 On Behalf Of Mriswithe Sent: Thursday, August 12, 2021 8:09 PM To: Tim Roberts Cc: python-win32 at python.org Subject: Re: [python-win32] windows images on clipboard Awesome, thank you so much for that info. That makes my tail chasing make more sense! Thanks for saving me from additional posterior extension pursuit. Last question I think, how do I put a file path reference on the clipboard similar to in explorer selecting a few files and hitting control c ? I think I had tested that with discord and it worked, but not 100% on that. On Thu, Aug 12, 2021, 11:57 AM Tim Roberts > wrote: Mriswithe wrote: > > I was looking at making a little helper app for Windows that will take > an image on your clipboard and ensure it is under 8MB for posting to > discord, and if it isn't, use Pillow to resize it until it is the > right size. > > I can use Pillow's ImageGrab.grabclipboard() to get the image off the > clipboard, but I am a little confused about writing it back. I have > been back and forth between the pywin32 source and the windows docs > for the windows C API, but I don't have any previous experience or > context to know what some pieces are intended to do. > > I found an example to write to it from StackOverflow > (https://stackoverflow.com/questions/34322132/copy-image-to-clipboard [stackoverflow.com] > >), > but I was wanting to dig a little deeper to see what formats other > than BMP I could use to put on the clipboard. My ignorance of C++ and > the Windows APIs and hell the Python C API is really biting me here. You can't. You have to write it as a DIB (Device Independent Bitmap), which is the format in a .BMP file. The Windows clipboard was designed in roughly 1986, before GIF, before JPEG and way, way before PNG. The clipboard is designed for universal interchange, so it really does need to spec the lowest common denominator. If they allowed PNGs, then all of the graphics application in the world would have to be modified to decode PNG data. So, to make your app work, save the result as a BMP. > Is there a bit of an idiots example guide for how to say, put a PNG on > the clipboard or a JPG? Some example code? There is a ton of useful > info in the pywin32 repo, but I haven't found anything that has made > this click for me. There is no idiots guide, because it cannot be done. Well, technically speaking you can put arbitrary binary data into the clipboard, but other graphics applications will not be able to read it. When they look for image data, they look for format CF_DIB, and that means a .BMP. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 [mail.python.org] Internal Use - Confidential -------------- next part -------------- An HTML attachment was scrubbed... URL: From ludovic.giraud-ext at amundi.com Wed Aug 18 14:37:47 2021 From: ludovic.giraud-ext at amundi.com (Giraud Ludovic (AMUNDI)) Date: Wed, 18 Aug 2021 18:37:47 +0000 Subject: [python-win32] Troubleshooting with moving Outlook emails to subfolders Message-ID: Hello Mark, I am stuck on this issue: https://github.com/mhammond/pywin32/issues/1743 I am trying to move outlook emails into subfolders and this works well most of the time. However in some cases, probably when a copy of the email I am trying to move already exists into the subfolder, I get the error below using: x.Move(self.folder.Folders("Inbox").Folders("VALORISATIONS").Folders("Allianz")) Is there a way to specify that you want to eventually crush the existing email in the folder? 21%|?? | 448/2154 [05:53<22:25, 1.27it/s] Traceback (most recent call last): File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 1114, in GestionBoitePDP.get_mail_print_to_csv(skipgetpasswords = "Y") File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 1104, in get_mail_print_to_csv self.case_select(macro_to_call,x,attachments) File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 77, in case_select switcher = { File "C:/Users/giraudl/PycharmProjects/AutomatePDP/AutomatePDP.py", line 183, in ALLIANZ x.Move(self.folder.Folders("Inbox").Folders("VALORISATIONS").Folders("ALLIANZ")) File ">", line 2, in Move pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', "Les ?l?ments ont ?t? copi?s et non pas d?plac?s, car les ?l?ments d'origine ne peuvent pas ?tre supprim?s. Impossible de supprimer cet ?l?ment. Il a ?t? d?plac? ou supprim?, ou l'acc?s a ?t? refus?.", None, 0, -2147219840), None) Thanks for your precious help. Kind regards, Ludovic Giraud PBM - Portfolios & Benchmarks Management Global Data Management 91 boulevard Pasteur CS 21564 75730 Paris Cedex 15 Web?: www.amundi.com T?l?: +33 1 76 32 67 92 @ : ludovic.giraud-ext at amundi.com Suivez-nous sur?: -----Message d'origine----- De?: Mark Hammond Envoy??: vendredi 30 juillet 2021 02:55 ??: Giraud Ludovic (AMUNDI) ; python-win32 at python.org Objet?: Re: [python-win32] Troubleshooting with pip install pywin32 using WSL2:Ubuntu and Python 3.8.8 On 29/07/2021 11:05 pm, Giraud Ludovic (AMUNDI) wrote: > Hello, > > When I run pip install pywin32 in WSL2:Ubuntu using Python 3.8.8 I get > the following error log: WSL is a linux environment - pywin32 simply doesn't work there. You can install it via a Windows command-prompt, or in WSL stick to the versions of Python that work for Ubuntu but without pywin32. HTH, Mark From mhammond at skippinet.com.au Thu Aug 19 00:56:29 2021 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 19 Aug 2021 14:56:29 +1000 Subject: [python-win32] Troubleshooting with moving Outlook emails to subfolders In-Reply-To: References: Message-ID: <168d689b-f2c9-bcb9-6323-14bba1f6bfbd@skippinet.com.au> On 19/08/2021 4:37 am, Giraud Ludovic (AMUNDI) wrote: > Hello Mark, > > I am stuck on this issue: https://github.com/mhammond/pywin32/issues/1743 > > I am trying to move outlook emails into subfolders and this works well most of the time. > > However in some cases, probably when a copy of the email I am trying to move already exists into the subfolder, I get the error below using: > x.Move(self.folder.Folders("Inbox").Folders("VALORISATIONS").Folders("Allianz")) > > Is there a way to specify that you want to eventually crush the existing email in the folder? I'm afraid it's been over 10 years since I used Outlook's COM model. Hopefully someone else here will comment, but 2 observations: * Search and delete for the mail firstt to see if the problem goes away? That will at least validate your hypothesis. * Don't restrict your googling to Python - this issue will exist in all languages which use Outlook via COM and the subsequent solution will be identical. Good luck, Mark From jacob at blindza.co.za Thu Aug 19 05:34:43 2021 From: jacob at blindza.co.za (jacob kruger) Date: Thu, 19 Aug 2021 11:34:43 +0200 Subject: [python-win32] Debugging python with something like VS code, when working with flask web framework In-Reply-To: <1b14faee-2d1e-5958-7a8c-621d6a6902d0@blindza.co.za> References: <1b14faee-2d1e-5958-7a8c-621d6a6902d0@blindza.co.za> Message-ID: Side note - switching over to django instead of flask, and, debugging stopping on breakpoints inside VS code seems to work a bit better, but, along the lines of that, figured out that what might work a bit better from my perspective is using python's own breakpoint() function call to invoke [pdb] in the output console, where I can then type in querying code, etc., before then typing in continue and hitting enter to let code resume execution, and, if launching execution from within VS code, then I use ctrl + F5, to launch the process without it's own debugging initiated, etc. Jacob Kruger +2782 413 4791 Skype: BlindZA "Resistance is futile...but, acceptance is versatile..." "...resistance is futile...but, acceptance is versatile..." On 2021-08-13 08:41 AM, jacob kruger wrote: > Hi there > > > I am specifically trying to sort out debugging code and processes when > working with the flask web development framework, while working with > VS code insiders. > > > Now, following things like the following steps, but, specifically > using an external terminal, I can get it to pause on breakpoints, etc. > when executing normal code, but, when trying to run it against the > flask module process, it seems to just execute the code and not manage > to attach to the execution processes, etc.? > > > > Python and flask tutorial in VS code: > > https://code.visualstudio.com/docs/python/tutorial-flask > > > > Or, the more generic debugging implementation tutorial: > > Getting started tutorial for python and VS code: > > https://code.visualstudio.com/docs/python/python-tutorial#_configure-and-run-the-debugger > > > > > This is working on a windows 10 64 bit pro machine, and, just want to > know if anyone has suggestions with regards to implementing debugging > when working with web development frameworks like flask, pyramid, etc.? > > > TIA > > > Jacob Kruger > +2782 413 4791 > Skype: BlindZA > "Resistance is futile...but, acceptance is versatile..." > "...resistance is futile...but, acceptance is versatile..." > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32