Re: Run Windows commands from Python console

2017-09-03 Thread eryk sun
On Sun, Sep 3, 2017 at 7:56 AM, wrote: > > I run Python console in Windows. Can I run cmd prompt commands > there? Python doesn't know the first thing about CMD's "batch" language. Also, Python's shell (i.e. REPL) is not a system administration shell that implicitly runs external commands. You n

Re: ANN: psutil 5.3.0 with full unicode support is out

2017-09-03 Thread eryk sun
On Sun, Sep 3, 2017 at 9:58 AM, Giampaolo Rodola' wrote: > > - #1040: all strings are encoded by using OS fs encoding. > - #1040: the following Windows APIs on Python 2 now return a string instead > of > unicode: > - Process.memory_maps().path > - WindowsService.bin_path() > - WindowsServi

Re: ANN: psutil 5.3.0 with full unicode support is out

2017-09-03 Thread eryk sun
On Sun, Sep 3, 2017 at 11:09 PM, Giampaolo Rodola' wrote: > > This is an example which filters processes with a funky name which works > with both Python 2 > and 3: > > import psutil, sys > > PY3 = sys.version_info[0] == 2 > LOOKFOR = u"ƒőő.exe" > for proc in psutil.process_iter(at

Re: Python console's workspace path

2017-09-05 Thread eryk sun
On Tue, Sep 5, 2017 at 9:26 AM, Andrej Viktorovich wrote: > > I run Python 3.6 console under windows 10. Where is default console directory? The working directory for the console (i.e. conhost.exe) is irrelevant to Python. So I assume you mean the default working directory of the Python shell (i.

Re: remove path forever

2017-09-07 Thread eryk sun
On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich wrote: > > I have 64 bit python on my windows 10 machine. Install contains 32 bit python > libs in path > and I would like to remove them. > > I do > imprt sys > sys.path.remove("C:\\Users\\me\\AppData\\Local\\Programs\\Python\\Python36-32") > >

Re: remove path forever

2017-09-07 Thread eryk sun
On Thu, Sep 7, 2017 at 9:25 AM, Andrej Viktorovich wrote: > On Thursday, 7 September 2017 14:35:58 UTC+3, eryk sun wrote: >> On Thu, Sep 7, 2017 at 1:39 AM, Andrej Viktorovich >> wrote: >> > >> > I have 64 bit python on my windows 10 machine. Install contains

Re: Delay a computation in another thread

2017-09-08 Thread eryk sun
On Fri, Sep 8, 2017 at 10:03 AM, Thomas Jollans wrote: > On 2017-09-08 16:49, Steve D'Aprano wrote: > >> Sorry for the long delay in replying to this, but if I set its daemon >> attribute, >> won't that mean it will live on after the interpreter shuts down? >> >> Also, what happens if it tries to

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 9:48 AM, Paul Moore wrote: > On 6 October 2017 at 09:36, Peter J. Holzer wrote: >> On 2017-10-06 08:09, Steve D'Aprano wrote: >> >>> # 1 detect input coming from a pipe. >>> import sys >>> import os >>> from stat import S_ISFIFO >>> if S_ISFIFO(os.fstat(0).st_mode): >>>

Re: The "loop and a half"

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 2:35 PM, Paul Moore wrote: > > cmd: > for /f %i in ('gcc -E program.c') do ... Note that CMD processes the output as decoded Unicode text instead of encoded bytes. This is often a source of mojibake. It runs the above command with stdout redirected to a pipe, and it dec

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 1:31 PM, Thomas Jollans wrote: > On 2017-10-06 12:33, Ben Bacarisse wrote: > >> A general solution to the (rather odd) complaint about silent waiting >> should really check any input fileno to see if a prompt is needed. You >> could argue, though, that anyone who's re-arran

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 4:27 PM, Thomas Jollans wrote: > On 2017-10-06 17:01, eryk sun wrote: >> >> POSIX defines STDIN_FILENO as 0, and the Windows C runtime reserves FD >> 0 to map to the native StandardInput handle. But as I noted in a >> previous message, on Windows

Re: The "loop and a half"

2017-10-07 Thread eryk sun
On Sat, Oct 7, 2017 at 1:06 PM, bartc wrote: > > So I have to copy 33,000 lines from a document, get to the terminal (keeping > that document open because I'm not done with it), start 'sort', and paste > those 33,000 lines into the console, then type Ctrl-D. Which then promptly > prints the newly

Re: The "loop and a half"

2017-10-08 Thread eryk sun
On Sun, Oct 8, 2017 at 10:12 AM, Steve D'Aprano wrote: > On Sun, 8 Oct 2017 02:06 am, bartc wrote: > >> Especially on >> Windows where the usual Ctrl C doesn't work, so you resort to Ctrl-Break >> will which actually abort it. Ctrl Z is uncommon. > > Thousands of Python programmers on Windows succ

Re: Is there a way to globally set the print function separator?

2017-10-09 Thread eryk sun
On Mon, Oct 9, 2017 at 10:04 PM, John Black wrote: > In article , python@example.invalid says... >> >> Le 09/10/2017 à 18:22, John Black a écrit : >> > I want sep="" to be the default without having to specify it every time I >> > call print. Is that possible? >> >> >>> oldprint = print >> >>>

Re: pathlib PurePosixPath

2017-10-10 Thread eryk sun
On Tue, Oct 10, 2017 at 11:18 AM, Tim Golden wrote: > On 2017-10-10 10:58, Chris Angelico wrote: >> On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: >> >>> In fact its presence in that filename creates a (usually hidden) data >>> stream piggybacked onto that file which has the name "abc" into w

Re: Calling of GetVolumeInformation returns empty serial number

2017-11-07 Thread eryk sun
On Tue, Nov 7, 2017 at 7:58 AM, Durumdara wrote: > > I want to get the serial number of the drives (without external modules > like Win32 or WMI). The volume serial number is more easily available as os.stat(drive).st_dev, which comes from calling GetFileInformationByHandle. Note that despite usi

Re: ctypes help

2017-11-18 Thread eryk sun
On Fri, Nov 17, 2017 at 10:11 PM, Python wrote: > > I'm starting to play with ctypes, as I'd like to provide Python > interfaces to a C/C++ library I have. For now I'm just messing with a > very simple piece of code to get things sorted out. I'm working with > this example C++ library, which ju

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-12 Thread eryk sun
On Tue, Dec 12, 2017 at 3:30 PM, Chris Angelico wrote: > On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson > wrote: >> Chris Angelico wrote: >> >>> Which is why OS/2, back in the 1990s, had *multiple* >>> associations for any given file. You could use file types >>> (sadly not MIME types - this was

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-13 Thread eryk sun
On Wed, Dec 13, 2017 at 5:43 AM, Chris Angelico wrote: > > A Windows equivalent would be to have a .py file associated normally > with the regular console, but some individual ones associated with > pythonw.exe - without renaming them to .pyw. AFAIK there is no way to > do this on Windows short of

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-13 Thread eryk sun
On Wed, Dec 13, 2017 at 9:04 PM, Chris Angelico wrote: > On Thu, Dec 14, 2017 at 7:56 AM, eryk sun wrote: >> On Wed, Dec 13, 2017 at 5:43 AM, Chris Angelico wrote: >>> >>> A Windows equivalent would be to have a .py file associated normally >>> with the regul

Re: Right way to io.open(...) an existing file object in Python 2.7?

2018-01-16 Thread eryk sun
On Tue, Jan 16, 2018 at 4:00 PM, Skip Montanaro wrote: > I'd like to take advantage of the seekable() method of io.IOBase with > existing open file objects, especially the standard in/out/err file > objects. io.open can open a file descriptor. If you don't use a duplicated FD (os.dup), then you p

Re: Can't get python running

2018-01-22 Thread eryk sun
On Sun, Jan 21, 2018 at 10:57 AM, Paul Moore wrote: > > The "py" launcher is always added to PATH. It's installed by default > (and always has been I believe) although there is a checkbox you can > untick if you don't want to install it. Yes, we can choose to not install the launcher. However, if

Re: Help: 64bit python call c and got OSError: exception: access violation writing 0xFFFFFFFF99222A60

2018-01-22 Thread eryk sun
On Mon, Jan 22, 2018 at 9:00 PM, Jason Qian via Python-list wrote: > > I am using ctypes on Windows to interface with a dll and it works fine > on Linux and windows 32-bit python. But, when using 64-bit python, we got > error "exception: access violation writing 0x99222A60". > > from cty

Re: Processing a key pressed in Python 3.6

2018-01-23 Thread eryk sun
On Tue, Jan 23, 2018 at 11:29 PM, Virgil Stokes wrote: > > How would this code be modified to handle using the "Esc" key instead of the > "Enter" key? The input() function depends on the console or terminal to read a line of input. If you're using the Windows console, it calls the high-level Read

Re: Processing a key pressed in Python 3.6

2018-01-24 Thread eryk sun
On Wed, Jan 24, 2018 at 8:02 PM, Virgil Stokes wrote: > Yes, I am aware of this Dennis. However, but, on my system I actually had it > running without the msvcrt.kbhit() _getwch loops calling ReadConsoleInput until a key event is read. The key can be typed manually in the console, or posted (i.e.

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread eryk sun
On Sun, Jan 28, 2018 at 4:36 PM, Steven D'Aprano wrote: > On Sun, 28 Jan 2018 15:54:31 +, Tim Golden wrote: > >> At least for Windows users, grabbing a partial screenshot (eg of text) >> has been very easy since Windows 7 when the "Snipping Tool" was added to >> the builtins. > > Thanks, I did

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread eryk sun
On Mon, Jan 29, 2018 at 5:34 PM, John Gordon wrote: > > The displayed filename in File Explorer was input.txt -- meaning that the > real filename was actually input.txt.txt, because File Explorer shows file > extensions as a separate column. One of the first things I do after creating an account

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread eryk sun
On Mon, Jan 29, 2018 at 7:43 PM, John Ladasky wrote: > On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: >> >> (The day a programmer posts a WAV file of themselves reading their code >> out aloud, is the day I turn my modem off and leave the internet forever.) > > What's a...

Re: Handle SIGINT in C and Python (Posting On Python-List Prohibited)

2018-01-31 Thread eryk sun
On Thu, Feb 1, 2018 at 4:57 AM, Victor Porton wrote: > Lawrence D’Oliveiro wrote: > >> On Thursday, February 1, 2018 at 8:10:24 AM UTC+13, Victor Porton wrote: >>> Lawrence D’Oliveiro wrote: >>> The usual behaviour for POSIX is that the call is aborted with EINTR after you get the signal

Re: Where has the practice of sending screen shots as source code come from?

2018-02-03 Thread eryk sun
On Fri, Feb 2, 2018 at 6:28 PM, Gilmeh Serda wrote: > > M$'s excuse for a real Terminal, "Power" Shell (sigh), is _slightly_ > better but still lacking lots of features. Like a decent scripting > language. I loath VBS. ¦þ,,, /puke PowerShell is a .NET scripting language that's available in Window

Re: abspath returns different results when py_compile input path is different in Python?

2018-02-12 Thread eryk sun
On Mon, Feb 12, 2018 at 9:40 AM, lampahome wrote: > I want to know abspath of python script followed by steps below. > >1. *built it to byte code by py_compile.* >2. *execute it to check abspath.* > > But I got *2 results* when I execute it.I found the *results based on the > path of scrip

Re: No shortcut Icon on Desktop

2022-04-18 Thread Eryk Sun
On 4/15/22, Grant Edwards wrote: > > The problem is that people run the installer, don't see a desktop > icon, and think nothing has been installed. Such people need to learn how to use the start menu, where all of Python's shortcuts are installed in a folder named "Python ". One can also press t

Re: upgrade pip

2022-04-23 Thread Eryk Sun
On 4/22/22, Tola Oj wrote: > im trying to upgrade my pip so i can install openpyxl. i though i had > successfully upgraded pip, and then I was trying to install openpyxl, but I > was getting this: > > C:\Users\ojomo>"C:\Program Files\Python310\python.exe" -m pip install > --upgrade > > [...] > > "

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Eryk Sun
On 4/23/22, Sunil KR via Python-list wrote: > > I am happy with how the python starts up. When I use python I get > python 2. I am ok with using py -3 for my new scripts, even using the > shebang like #!py -3 `#!py -3` is not a valid shebang for the py launcher. Use `#!python3` to run a script wi

Re: Verifying I installed Python correctly

2022-04-25 Thread Eryk Sun
On 4/25/22, Barry wrote: > >> On 25 Apr 2022, at 21:14, Jack Dangler wrote: > >> Have you tried >> >> python3 hello.py > > Will not work on windows. Python is always installed as python.exe and > py.exe only. Yes, except the app versions installed from the Microsoft Store do create appexec alias

Re: Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-03 Thread Eryk Sun
On 5/1/22, Brent Hunter wrote: > > I was recently running a Windows 10 machine Python 3.9. I simply created a > batch file titled "Start-AIG.bat" which simply contained the following: > "pythonw AIG.py". It started a python program titled "AIG.py" and the > Python dialog box was displayed on my

Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
On 5/12/22, Mike Dewhirst wrote: > > access=wr.KEY_ALL_ACCESS + wr.KEY_WRITE, The access parameter is a bit mask of access rights that combine via bitwise OR (|), not via arithmetic addition. KEY_ALL_ACCESS (0x000F_003F) is a superset of KEY_WRITE (0x0002_0006): KEY_WRITE = (

Re: [Solved] Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE HKEY_USERS HKEY_PERFORMANCE_DATA WinAPI RegConnectRegistryW() only matters when the target computer is a different machi

Re: [Solved] Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
On 5/13/22, Mike Dewhirst wrote: > On 13/05/2022 4:14 pm, Eryk Sun wrote: >> Since self.connect() is always called, you should document that the >> initial hkey parameter has to be one of the following predefined key >> handles: >> >> HKEY_LOCAL_MACHINE >

Re: Seeking deeper understanding of python equality (==)

2022-05-14 Thread Eryk Sun
On 5/14/22, Jonathan Kaczynski wrote: > > So, I'm still wondering how Py_TYPE(v)->tp_richcompare resolves to __eq__ > on a user-defined class. Conversely, my understanding is, for a type > defined in cpython, like str, there is usually an explicitly > defined tp_richcompare function. Sometimes it

Re: Discerning "Run Environment"

2022-05-18 Thread Eryk Sun
On 5/18/22, Chris Angelico wrote: > > Real solution? Set the command prompt to codepage 65001. Then it > should be able to handle all characters. (Windows-65001 is its alias > for UTF-8.) I suggest using win_unicode_console for Python versions prior to 3.6: https://pypi.org/project/win_unicode_c

Re: pip does not find after Python 3.10.4 installed

2022-05-26 Thread Eryk Sun
On 5/26/22, ANTHONY CHU wrote: > The Python 3.10.4 (64-bit) and Python Launcher had been (standard) installed > successfully. But I could not find pip anywhere. I uninstalled and > re-installed a couple of times, it is still the problem. I checked the > installed directory > C:\Users\x\AppDat

Re: .0 in name

2022-05-28 Thread Eryk Sun
On 5/28/22, Chris Angelico wrote: > > be extremely confusing; so to keep everything safe, the interpreter > generates a name you couldn't possibly want - same as for the function > itself, which is named "" or "", angle brackets > included. To clarify, "" is the co_name and co_qualname value of t

Re: PYLAUNCH_DEBUG not printing info

2022-06-09 Thread Eryk Sun
On 6/9/22, Peter Otten <__pete...@web.de> wrote: > > Looks like the variable is now called PYLAUNCHER_DEBUG: > > https://docs.python.org/3.11/using/windows.html#diagnostics I wonder why Steve changed the name of the environment variable without supporting the old "PYLAUNCH_DEBUG" name, at least fo

Re: ModuleNotFoundError

2022-06-17 Thread Eryk Sun
On 6/17/22, Zoltan Szenderak wrote: > > print(sys.version_info) and executable: > Unable to initialize device PRN That's the command-line "print" program. You need to first start the Python shell via python.exe. The prompt should change to ">>> ". Then run print(sys.version) and print(sys.executa

Re: "CPython"

2022-06-21 Thread Eryk Sun
On 6/20/22, Paulo da Silva wrote: > > Yes, but that does not necessarily means that the C has to refer to the > language of implementation. It may well be a "core" reference to > distinguish that implementation from others with different behaviors. If the reference implementation and API ever swi

Re: Byte arrays and DLLs

2022-06-30 Thread Eryk Sun
On 6/30/22, Rob Cliffe via Python-list wrote: > > AKAIK it is not possible to give ctypes a bytearray object and persuade > it to give you a pointer to the actual array data, suitable for passing > to a DLL. You're overlooking the from_buffer() method. For example: >>> ba = bytearray(10)

Re: script folder is empty

2022-07-18 Thread Eryk Sun
On 7/17/22, Scott Baer wrote: > > I've done some troubleshooting, and nothing is in the C:\Program > Files\Python310\Scripts folder. The installer may have silently failed to install pip. Run the following command to check whether the package was installed. "C:\Program Files\Python310\python

Re: Pip upgrade causing issues in 3.10

2022-07-20 Thread Eryk Sun
On 7/20/22, Mike Dewhirst wrote: > On 20/07/2022 4:43 am, David Raymond wrote: >> C:\Program Files\Python310\Scripts>..\python.exe -m pip install --upgrade >> pip >> ERROR: Could not install packages due to an OSError: [WinError 32] The >> process cannot access the file because it is being used by

Re: exec() an locals() puzzle

2022-07-20 Thread Eryk Sun
On 7/20/22, george trojan wrote: > > 1. This works as I expect it to work: > > def f(): > i = 1 > print(locals()) > exec('y = i; print(y); print(locals())') > print(locals()) > exec('y *= 2') > print('ok:', eval('y')) > f() In CPython, the locals of a function scope (as op

Re: Persistent Error: Python was not found

2022-08-15 Thread Eryk Sun
On 8/13/22, Jonathan Owah wrote: > > I've been trying to configure my laptop to run python scripts. > This is the error I keep getting: > Python was not found; run without arguments to install from the Microsoft > Store, or disable this shortcut from Settings > Manage App Execution > Aliases. If

Re: Persistent Error: Python was not found

2022-08-15 Thread Eryk Sun
On 8/15/22, Jonathan Owah wrote: > Thank you so much for your assistance . > > The fault was actually mine: I was running a command > with python3, instead of just python. > python3 works for Mac, but not Windows. If the Python 3.10 store app is installed with all aliases enabled, then "python",

Re: Persistent Error: Python was not found

2022-08-15 Thread Eryk Sun
On 8/15/22, Gisle Vanem via Python-list wrote: > Eryk Sun wrote: > >> If the redirector app >> is run without arguments, it will open the Microsoft Store to install >> the latest version of the Python store app distribution. Currently >> that means Python 3.10. >

Re: Persistent Error: Python was not found

2022-08-15 Thread Eryk Sun
On 8/15/22, Dennis Lee Bieber wrote: > > Just double-clicking on the file will run it. The problem is that it > will open a command shell, run, and then close the command shell UNLESS one > explicitly codes some sort of "hold" at the end of the program The console window is a terminal, not

Re: subprocess.popen how wait complete open process

2022-08-22 Thread Eryk Sun
On 8/21/22, simone zambonardi wrote: > Hi, I am running a program with the punishment subrocess.Popen(...) what I > should do is to stop the script until the launched program is fully open. > How can I do this? I used a time.sleep() function but I think there are > other ways. Thanks In Windows,

Re: Download Python 3.10.6 for windows

2022-08-30 Thread Eryk Sun
On 8/30/22, George Rwaga wrote: > > 1. I installed Python 3.10.6 in the default directory > C:\Users\x.x\AppData\local\programs\Python\Python310 > After the installation, there was no shortcut on my desktop. Shortcuts are created in the start menu. The installer doesn't modify the user's

Re: Download Python 3.10.6 for windows

2022-08-31 Thread Eryk Sun
On 8/31/22, George Rwaga wrote: > > I am not sure why the default for installing Python is > C:\Users\x.x\AppData\local\programs\Python\Python310. The "programs" folder in the above path is the default location to install programs just for user "x.x." More precisely, the default l

Re: Local variable definition in Python list comprehension

2022-09-01 Thread Eryk Sun
On 9/1/22, James Tsai wrote: > > I find it very useful if I am allowed to define new local variables in a > list comprehension. For example, I wish to have something like > [(x, y) for x in range(10) for y := x ** 2 if x + y < 80], or > [(x, y) for x in range(10) with y := x ** 2 if x + y < 80]. >

Re: How to make a variable's late binding crosses the module boundary?

2022-09-01 Thread Eryk Sun
On 8/31/22, Jach Feng wrote: > > I found that using "from test import *" in test2.py makes test2's relation > to "test" almost like the function's relation to the module where it is > defined. You can refer to all the variables of the module Note that in general, if __all__ doesn't exist to expli

Re: Can you mock a C function using ctypes?

2022-09-15 Thread Eryk Sun
On 9/15/22, Grant Edwards wrote: > > Can that be done using ctypes? > > For example, I open a library that contains functon foo() where foo() > calls external function bar() which is not contained in the library. > Then, I provide a Python bar() function that gets called by foo() when > foo() is c

Re: Can you mock a C function using ctypes?

2022-09-15 Thread Eryk Sun
On 9/15/22, Grant Edwards wrote: > > Does the pointer have to be passed? Or can it be "poked" into a global > variable? If the library exports the function pointer as a global variable, it can be set in ctypes using the in_dll() method. Unfortunately, as far as I know, a ctypes function prototype

Re: How to replace an instance method?

2022-09-16 Thread Eryk Sun
On 9/16/22, Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. A function is a descriptor that binds to any object as a method. For example: >>> f = lambda self, x: self + x >>> o = 42 >>> m = f.__get__(o) >>> type(m)

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
On 9/17/22, Chris Angelico wrote: > > The two are basically equivalent. Using functools.partial emphasizes > the fact that all you're doing is "locking in" the first parameter; > using the __get__ method emphasizes the fact that functions are, > fundamentally, the same thing as methods. Choose whi

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
On 9/17/22, Chris Angelico wrote: > > A method IS a function. A bound method is a function with one argument > locked in, but still a function. We were talking past each other. A method object is not a function object. You're talking about a function defined in a class that's accessed as a method

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/18/22, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >>types.MethodType( function, instance ) >>functools.partial( function, instance ) >>new_method.__get__( instance ) > > I wonder which of these three possibilities expresses > the idea of creating a new

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/19/22, 2qdxy4rzwzuui...@potatochowder.com <2qdxy4rzwzuui...@potatochowder.com> wrote: > On 2022-09-18 at 09:11:28 +, > Stefan Ram wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >> >types.MethodType( function, instance ) >> >functools.partial( function, instance ) >

Re: Debugging automatic quotation in subprocess.Popen()

2022-10-07 Thread Eryk Sun
On 10/7/22, c.bu...@posteo.jp wrote: > > I need to improve my understanding about how subprocess.Popen() does > quote arguments. I have special case here. > > Simple example: > Popen(['ls', '-l']) results on a shell in "ls -l" without quotation. The shell is only used if Popen is instantiated wit

Re: How to fix Python error, The term '.../python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program, in VS Code?

2022-10-11 Thread Eryk Sun
On 10/11/22, LouisAden Capellupo via Python-list wrote: > Variables. > C:\Users\It'sMeLil'Loui\AppData\Local\Programs\Python\Python310\Scripts\, > and C:\Users\It'sMeLil'Loui\AppData\Local\Programs\Python\Python310\. I suggest that you switch to a user account that doesn't have single quotes in

Re: Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Eryk Sun
On 10/12/22, Kirill Ratkin via Python-list wrote: > > Do anyone face issue like in log below? > > I got last installer (3.10.8) and try to install it 'for all users' with > downloading precompiled (pdb) files. There was a permission problem on the Python website that prevented downloading the 3.8

Re: Find the path of a shell command (shutil.which)

2022-10-12 Thread Eryk Sun
On 10/12/22, Weatherby,Gerard wrote: > > When no path is specified, the results of > os.environ() are used, > returning either the “PATH” value or a fallback of > os.defpath. The documentat

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-10-31 Thread Eryk Sun
On 10/31/22, darkst...@o2online.de wrote: > > i uninstalled this, because my Idle doesn’t start by clicking on the Icon. > Are there any Solutions for the problem? If it's the standard distribution from python.org, run the installer again, and ensure that the test suite is installed. In 3.10.8,

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-10-31 Thread Eryk Sun
On 10/31/22, darkst...@o2online.de wrote: > > I installed the Standard Distribution from python.org again, and i ensured, > that the checkmark test Suite is enabled. Idle does’nt start. The installer > says “Installation successfully” at the end. > > What went wrong and how can I further delimit t

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-01 Thread Eryk Sun
On 11/1/22, darkst...@o2online.de wrote: > > **IDLE can’t Import TKINTER > > Python may not be configured for TK** > > Checkmark for TK is set in the Installation Progress. What went wrong and ho > can I fix it? Run the following command to check whether the ImportError has any further informatio

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-01 Thread Eryk Sun
On 11/1/22, Nithish Ramasamy wrote: > > pip install tkinter > Wait some minutes to install tkinter There is no tkinter package on PyPI. It's part of the standard library and included with the python.org installer as an optional component. -- https://mail.python.org/mailman/listinfo/python-list

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-03 Thread Eryk Sun
On 11/3/22, darkst...@o2online.de wrote: > Is there a reason, why it is not installed? Its the same check mark in the > installer like IDLE… Did you try what I suggested? Modify the installation to remove the tkinter/IDLE component. Then modify it again to select the component to be reinstalled.

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-09 Thread Eryk Sun
On 11/9/22, darkst...@o2online.de wrote: > Is there no one who can help? If you can't run IDLE via `py -3.10-32 -m idlelib`, then something isn't installed properly. You reported an error that IDLE fails to load because importing tkinter fails. Did you try `import tkinter` in the REPL? tkinter de

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-11 Thread Eryk Sun
On 11/11/22, darkst...@o2online.de wrote: > > What can I do for the next step to find, why IDLE isn’t working? The question is why tkinter isn't working. IDLE not working is just a symptom of the underlying problem. In the command prompt, run 32-bit Python 3.10 via `py -3.10-32`. In Python's inte

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Eryk Sun
On 11/10/22, Jessica Smith <12jessicasmit...@gmail.com> wrote: > > Weird issue I've found on Windows images in Azure Devops Pipelines and > Github actions. Printing Unicode characters fails on these images because, > for some reason, the encoding is mapped to cp1252. What is particularly > weird ab

Re: Create a Python Launcher on Desktop

2022-11-11 Thread Eryk Sun
On 11/11/22, ohins...@gmail.com wrote: > > I am real a beginner of Python. Not able to create a Python launcher > (shortcut) on Desktop after the installation. Did you already install Python? If not, open the Store, and install the Python 3.11 app that's published by the Python Software Foundati

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Eryk Sun
On 11/11/22, 12Jessicasmith34 <12jessicasmit...@gmail.com> wrote: > > any idea why this would be happening in this situation? AFAIK, stdout > *is* a console when these images are running the python process. If sys.std* are console files, then in Python 3.6+, sys.std*.buffer.raw will be _io._Window

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-12 Thread Eryk Sun
On 11/12/22, darkst...@o2online.de wrote: > import _tkinter > Traceback (most recent call last): > File "", line 1, in > ImportError: DLL load failed while importing _tkinter: Das angegebene Modul > wurd > e nicht gefunden. Loading the extension module "_tkinter.pyd" tries to load two TCL

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Eryk Sun
On 11/13/22, Jessica Smith <12jessicasmit...@gmail.com> wrote: > Consider the following code ran in Powershell or cmd.exe: > > $ python -c "print('└')" > └ > > $ python -c "print('└')" > test_file.txt > Traceback (most recent call last): > File "", line 1, in > File "C:\Program Files\Python38\

Re: unable to resolve readline issues

2022-12-04 Thread Eryk Sun
On 12/2/22, biglee12...@gmail.com wrote: > > From this point on Python became unusable as I uninstalled rebooted then > reinstalled to find I have the same issues as stated. Finally uninstalled > Python as it doesn't perform as usual especially trying to understand the > use of pyreadline, gnurea

Re: Installation hell

2022-12-19 Thread Eryk Sun
On 12/18/22, Jim Lewis wrote: > > Sometimes it's a path issue. For whatever reason, Python installations on Windows lack versioned executable names (except for the Microsoft Store distribution). Thus adding multiple installations to PATH doesn't help unless "python.exe" is manually linked or copi

Re: How to enter escape character in a positional string argument from the command line?

2022-12-19 Thread Eryk Sun
On 12/19/22, Jach Feng wrote: > > That's really good for Linux user! How about Windows? In CMD, typing the "^" escape character at the end of a line ignores the newline and prompts for "more" input. If you press enter again, you'll get another "more" prompt in which you can write the rest of the

Re: Fwd: Installation hell

2022-12-20 Thread Eryk Sun
On 12/19/22, Chris Angelico wrote: > On Tue, 20 Dec 2022 at 09:12, Thomas Passin wrote: > >> @echo off >> setlocal >> : Find effective drive for this file. >> set ed=%~d0 >> path %ed%\python37\Scripts;%ed%\python37;%PATH% For reference, in case not everyone on the list knows what "%~d0" means, t

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, c.bu...@posteo.jp wrote: > > If the user request the usage info via "-h" it goes to stdout. The standard file for application output is sys.stdout. Note that sys.stdout may be buffered, particularly if it isn't a tty. When a file is buffered, writes are aggregated and only written to t

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Weatherby,Gerard wrote: > If sys.stdout is a tty, it typically flushes on newline. e. g. Sorry if I wasn't clear. Yes, a tty file will be buffered, but it's line buffering, which isn't an issue as long as lines are written to stdout. I was referring to full buffering of pipe and disk f

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > writing the FD is the same as using stdout Except stdout may be buffered. One should probably flush the buffer before each raw write to the file descriptor. > use /dev/tty to reach for the console directly. On Windows, open "CON" (read or write), "CONIN$" (r

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Grant Edwards wrote: > > That's definitely a better option, but I'm pretty sure I've seen > multiple examples over the decades where fd 0 was used instead. Was > /dev/tty a "recent" enough invention that I would have seen > application code that was written before it existed? Or maybe I

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > FDs can also be buffered. If it's buffering you want to avoid, don't > mess around with exactly which one you're writing to, just flush. I meant to flush a C FILE stream or Python file before writing directly to the file descriptor, in order to avoid out-of-se

Re: No solution for "--verbose" (on stdout) output in Pythonds standard library?

2023-01-04 Thread Eryk Sun
On 1/4/23, c.bu...@posteo.jp wrote: > > often seen "--verbose" switch in command line applications should > affect only the messages given to the users. This means messages on > "stdout". That is what this question is about. Is this additional context information such as help and definitions? If

Re: subprocess equivalent for "os.execvp()"?

2023-01-08 Thread Eryk Sun
On 1/8/23, c.bu...@posteo.jp wrote: > > is there an equivalent in the subprocess module for "os.execvp()" to > replace the current process with the new called one? A note for Windows users Avoid using any of the `os.exec*` functions on Windows. There's no support for replacing a Windows process

Re: subprocess equivalent for "os.execvp()"?

2023-01-09 Thread Eryk Sun
On 1/9/23, c.bu...@posteo.jp wrote: > > On Python for Windows what is the appropriate way how a process can call > itself again? > > Let me give you an example [1]: > There is a project "bitcli" having two entry points > > [project.scripts] > bitcli = "bitcli.__main__:main" > bitcli-root = "bitcli

Re: No module named 'playsound'‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏

2023-01-09 Thread Eryk Sun
On 1/9/23, MRAB wrote: > > On Windows it's best to use pip via the Python Launcher: > > py -m pip show playsound Python's app distribution on the Microsoft Store doesn't include the py launcher, and we don't (but should) have a standalone app or desktop version of the launcher. Unlike the desktop

Re: IDLE "Codepage" Switching?

2023-01-18 Thread Eryk Sun
On 1/17/23, Stephen Tucker wrote: > > 1. Can anybody explain the behaviour in IDLE (Python version 2.7.10) > reported below? (It seems that the way it renders a given sequence of bytes > depends on the sequence.) In 2.x, IDLE tries to decode a byte string via unicode() before writing to the Tk te

Re: Python not found

2023-01-26 Thread Eryk Sun
On 1/26/23, Bela Gesztesi wrote: > > C:\DJI>py comm_og_service_tool.py WM231 --port COM3 GimbalCalib JointCoarse > > Python was not found; run without arguments to install from the Microsoft > Store, or disable this shortcut from Settings > Manage App Execution > Aliases. Do what it's telling you

Re: Module use of python3_d.dll conflicts with this version of Python

2023-01-26 Thread Eryk Sun
On 1/26/23, Olivier B. wrote: > > Does someone know why it would have been chosen to be different for > debug builds? It's assumed that a debug build would normally link with "pythonXY_d.dll". Maybe it should be more defensive. Refer to the following setup in PC/pyconfig.h: /* For an MSVC DL

Re: Python not found

2023-01-27 Thread Eryk Sun
On 1/27/23, Bela Gesztesi wrote: > > I'm not that familiar with the steps to be taken. > > How do I find the app version of Python for my desktop? > or > I don't know how to disable the "python.exe" and "python3.exe" app aliases To install the app version, run "python3" from the command line. Thi

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-05 Thread Eryk Sun
On 3/5/23, aapost wrote: > > If a file is still open, even if all the operations on the file have > ceased for a time, the tail of the written operation data does not get > flushed to the file until close is issued and the file closes cleanly. This is normal behavior for buffered file I/O. There'

  1   2   3   4   5   6   7   >