Re: Compiling python on windows with vs

2023-06-15 Thread Eryk Sun via Python-list
On 6/15/23, Thomas Schweikle via Python-list wrote: > > No. This flag is not inherited. Someone has to set it for created > directories. It is easy to confirm: take a directory not under MSYS or > cygwin control (because it is mounted by MSYS or cygwin), set the flag, > then create directories.

Re: Compiling python on windows with vs

2023-06-15 Thread Eryk Sun via Python-list
On 6/15/23, Thomas Schweikle via Python-list wrote: > > In this case: not sure what is going on. Possibly you have a setting configured that affects the behavior of Git via the MinGW-w64 runtime, such that calling mkdir() ends up calling NtSetInformationFile() to set the

Re: Compiling python on windows with vs

2023-06-14 Thread Eryk Sun via Python-list
On 6/14/23, Inada Naoki via Python-list wrote: >> Since Git enables Windows NTFS case sensitivity while checking out sources > > I didn't know that. Would you give us a link to this feature? > As far as I know, `git config core.ignorecase` doesn't mean NTFS case > sensitive. If a repo is cloned

Re: Compiling python on windows with vs

2023-06-13 Thread Eryk Sun via Python-list
On 6/13/23, Thomas Schweikle via Python-list wrote: > > Since Git enables Windows NTFS case sensitivity while checking out > sources ... is it a bug or a "feature"? And: is there a simple AFAIK the Windows version of Git (you're not using the Linux version of Git via WSL, right?) does not

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-10 Thread Eryk Sun via Python-list
On 6/10/23, Thomas Passin via Python-list wrote: > > Yes; I didn't want to get too esoteric with commands that are hard to > figure out and remember, because then why not use Powershell, whose > commands are hard to figure out and remember? Using `dir /s [/ad] [/b] "[path\]pattern"` with a

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-10 Thread Eryk Sun via Python-list
On 6/10/23, Thomas Passin via Python-list wrote: > > We can find pip.exe using good old-fashioned dir (we don't need any > new-fangled Powershell): > > C:\Users\tom>dir AppData\Local\Programs\Python /Aa /S /W /B |find > "pip"|find "Scripts" CMD's `dir` and `for` commands support simple wildcard

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-08 Thread Eryk Sun via Python-list
On 6/8/23, Thomas Passin via Python-list wrote: > > It always gets installed, though. By default, the option to install pip is enabled. It's implemented by executing ensurepip after the interpreter is installed. However, ensurepip may silently fail during installation. As a CPython triager I've

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-08 Thread Eryk Sun via Python-list
On 6/7/23, Thomas Passin via Python-list wrote: > On 6/7/2023 6:28 PM, Eryk Sun wrote: > >> That won't be of any help if pip isn't installed. By default, Python's >> installer attempts to install pip by running the ensurepip package, >> but sometimes it fails. It can hel

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Eryk Sun via Python-list
On 6/7/23, Thomas Passin via Python-list wrote: > > You have by now seen several responses, and the one most likely to be > helpful is to run pip with > > py -m pip That won't be of any help if pip isn't installed. By default, Python's installer attempts to install pip by running the ensurepip

Re: Does os.path relpath produce an incorrect relative path?

2023-05-26 Thread Eryk Sun
On 5/26/23, cactus wrote: > > Surprisingly (for me at least) the alternative provided by the pathlib > module 'relative_to' method doesn't provide for full relative path > computation. I was expecting this would offer everything that os.path > offers but it doesn't in this case. Starting with

Re: Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread Eryk Sun
On 5/25/23, BlindAnagram wrote: > > vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj' > src_path = 'C:\\lib\\src\\' > rel_path = '..\\..\\..\\lib\\src' > > [snip] > > The first of these three results produces an incorrect relative path > because relpath does not strip off any non-directory tails

Re: PythonPath / sys.path

2023-05-14 Thread Eryk Sun
On 5/13/23, Grizzy Adams via Python-list wrote: > > I have tried adding my dir in registry to the existing PythonPath > > [HKEY_CURRENT_USER\Software\Python\PythonCore\3.4\PythonPath] > @="D:\\Shades\\Tools\\Python\\Lib;D:\\Shades\\Tools\\Python\\DLLs" > > that did not help, The default value of

Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Eryk Sun
On 5/11/23, Jason Qian via Python-list wrote: > > in the Python, I have a array of string > var_array=["Opt1=DG","Opt1=DG2"] > I need to call c library and pass var_array as parameter > In the argtypes, how do I set up ctypes.POINTER(???) for var_array? > >

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread Eryk Sun
On 5/9/23, Thomas Passin wrote: > > I'm not sure if this exactly fits your situation, but if you use > subprocess with pipes, you can often get a deadlock because the stdout > (or stderr, I suppose) pipe has a small capacity and fills up quickly > (at least on Windows), The pipe size is

Re: Christoph Gohlke and compiled packages

2023-04-12 Thread Eryk Sun
On 4/12/23, Mike Dewhirst wrote: > > Collecting psycopg2==2.9.3 x86 and x64 wheels are available for Python 3.11 if you can use Psycopg 2 version 2.9.5 or 2.9.6 instead of 2.9.3: https://pypi.org/project/psycopg2/2.9.5/#files https://pypi.org/project/psycopg2/2.9.6/#files --

Re: Windows installer from python source code without access to source code

2023-04-06 Thread Eryk Sun
On 4/6/23, Jim Schwartz wrote: > Never mind. I found it on the web. I needed to point my PYTHONPATH to > sitepackages: In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the

Re: [Python-Dev] Small lament...

2023-04-01 Thread Eryk Sun
On 4/1/23, Skip Montanaro wrote: > Just wanted to throw this out there... I lament the loss of waking up on > April 1st to see a creative April Fool's Day joke on one or both of these > lists, often from our FLUFL... Maybe such frivolity still happens, just not > in the Python ecosystem? I

Re: Windows Gui Frontend

2023-04-01 Thread Eryk Sun
On 4/1/23, Jim Schwartz wrote: > Are there any ide’s that will let me design the screen and convert it to > python? I doubt it because it was mentioned that this is time consuming. > > Thanks for the responses everyone. I appreciate it. For Qt, the WYSIWYG UI editor is Qt Designer. The basics

Re: Windows Gui Frontend

2023-04-01 Thread Eryk Sun
On 4/1/23, Jim Schwartz wrote: > I have another question. I have an app written in python, but I want to > add a windows GUI front end to it. Can this be done in python? What > packages would allow me to do that? Here are a few of the GUI toolkit libraries in common use: * tkinter (Tk)

Re: Python not showing correct version

2023-04-01 Thread Eryk Sun
On 4/1/23, Barry Scott wrote: > > I find user environment on windows to be less flexible to work with then > adding a py.ini. On my Windows 11 I added > %userprofile%\AppData\Local\py.ini. > To make python 3.8 the default that py.exe uses put this in py.ini: > > [defaults] > python=3.8-64 >

Re: Python not showing correct version

2023-03-31 Thread Eryk Sun
On 3/31/23, Thomas Passin wrote: > > The store app doesn't install py.exe, does it? That's a significant downside of the store app. You can install Python 3.7-3.11 from the store, and run them explicitly as "python3.7.exe", "pip3.7.exe", "python3.11.exe", "pip3.11.exe", etc. But without the

Re: Python not showing correct version

2023-03-31 Thread Eryk Sun
On 3/31/23, Sumeet Firodia wrote: > > One more thing is that pip --version also refers to python 3.10 > > C:\Users\admin>pip --version > pip 23.0.1 from > C:\Users\admin\AppData\Local\Packages > \PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0 >

Re: Windows installer from python source code without access to source code

2023-03-31 Thread Eryk Sun
On 3/31/23, Jim Schwartz wrote: > I want a windows installer to install my application that's written in > python, but I don't want the end user to have access to my source code. Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and

Re: Ole version set as default

2023-03-29 Thread Eryk Sun
On 3/29/23, Pranav Bhardwaj wrote: >I am Pranav Bhardwaj and I stuck in a problem. My problem is > that in my system I have python 3.11.2 but when I type python in my command > prompt, my command prompt show that python version 2.7.13 as a default. Run the following command in

Re: Baffled by readline module

2023-03-10 Thread Eryk Sun
On 3/9/23, Greg Ewing via Python-list wrote: > On 10/03/23 4:00 pm, 2qdxy4rzwzuui...@potatochowder.com wrote: >> My ~/.pythonrc contains the following: >> >> import readline >> import rlcompleter >> readline.parse_and_bind( 'tab: complete' ) > > I don't have a ~/.pythonrc, so

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.

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.

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

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

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

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

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 =

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: 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: 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

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

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$"

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

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

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,

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: 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

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,

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

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

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

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

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

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

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

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-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-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

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

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: 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

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

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: 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

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: 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-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

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

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: 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

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

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

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: 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

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: 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: 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: 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

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/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: 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

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

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

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: "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

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

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

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

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 >

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:

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

Re: [Solved] Re: Windows registry PermissionError

2022-05-13 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: [Solved] Re: Windows registry PermissionError

2022-05-13 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

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: 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: 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

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

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: 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

[issue47203] ImportError: DLL load failed while importing binascii: %1 is not a valid Win32 application.

2022-04-05 Thread Eryk Sun
Eryk Sun added the comment: There is something fundamentally wrong with the way modules built into the interpreter DLL (python3x.dll) are loaded if anything in sys.path or the system PATH can cause an import to fail. -- ___ Python tracker <ht

[issue47203] ImportError: DLL load failed while importing binascii: %1 is not a valid Win32 application.

2022-04-03 Thread Eryk Sun
Eryk Sun added the comment: The user site packages directory is architecture specific starting with 3.10, e.g. "%AppData%\Python\Python310-32\site-packages". The PYTHONPATH environment variable is shared by all versions. However, I don't understand how the binascii mo

[issue47198] os.stat on windows doesn't take an open file even though os.stat in os.supports_fd

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: You're mistaken about what `fd` is. It's a TextIOWrapper, which wraps a BufferedWriter, which buffers a FileIO raw file object, which accesses the open file number fd.fileno(). For example: >>> f = open('tmp.tmp','w') >>> os.stat(f.filen

[issue47170] py launcher on windows opens new terminal window when parsing python script with shebang

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > This is Windows (shell) behaviour. To avoid this, you need to > add the .py extension to the PATHEXT environment variable. PowerShell reuses the current console session only if .PY is set in PATHEXT. Otherwise Python gets executed with a flag that

[issue47161] pathlib method relative_to doesnt work with // in paths

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > Hmm..., I get it, but Im not gonna lie it's pretty confusing given > that in other places `//` works as a substitute for `/`. Maybe it > should be mentioned in the documentation? In Linux, the system resolves "//" as just "/&

[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > Now a file that doesn't exist: > >>> mike = Path("palin.jpg") > >>> mike.resolve() > WindowsPath('palin.jpg') This is a bug in resolve(). It was fixed in 3.10+ by switching to ntpath.realpath(). I don't remember w

  1   2   3   4   5   6   7   8   9   10   >