Re: Proper shebang for python3

2019-07-21 Thread eryk sun
On 7/20/19, Michael Speer wrote: > > You may want to use `#!/usr/bin/env python3` instead. This is partially supported in Windows, but only if .py files are associated with the py.exe launcher and the shebang runs "python" instead of "python3". py.exe supports four builtin virtual commands: "/us

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Kirill Balunov wrote: > import os from pathlib import Path dummy = " " # or "" or " " os.path.isdir(dummy) > False Path(dummy).is_dir() > True I can't reproduce the above result in either Linux or Windows. The results should only be different for an empt

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Chris Angelico wrote: > On Fri, Jul 26, 2019 at 3:28 AM eryk sun wrote: >> >> On 7/25/19, Kirill Balunov wrote: >> > >> >>>> import os >> >>>> from pathlib import Path >> >>>> dummy = " "

Re: Difference between os.path.isdir and Path.is_dir

2019-07-25 Thread eryk sun
On 7/25/19, Chris Angelico wrote: > On Fri, Jul 26, 2019 at 3:54 AM eryk sun wrote: > >> That's what I said. But the OP shows os.path.isdir(" ") == False and >> Path(" ").is_dir() == True, which is what I cannot reproduce and >> really shou

Re: fopen() and open() in cpython

2019-08-14 Thread eryk sun
On 8/13/19, Windson Yang wrote: > After my investigation, I found Since Python maintains its own buffer when > read/write files, the build-in python open() function will call the open() > system call instead of calling standard io fopen() for caching. So when we > read/write a file in Python, it

Re: How to record the console's content in the interpreter?

2019-08-23 Thread eryk sun
On 8/23/19, jf...@ms4.hinet.net wrote: > > it won't show output from print command, and "print" is the most > command used in a module when a response was needed ConEmu is an alternate console for Windows that allows logging all console output to a file: https://conemu.github.io/en/AnsiLogFiles.

Re: if STREAM.isatty():

2019-08-29 Thread Eryk Sun
On 8/29/19, Rhodri James wrote: > > "isatty()" is a method of the io.IOBase class that checks to see > if the stream is connected to a tty, or to use less jargon, if it is > interactive. "tty" was I think originally an abbreviation for > "teletype", but nowadays it refers to any terminal, anywher

Re: if STREAM.isatty():

2019-08-30 Thread Eryk Sun
On 8/29/19, Terry Reedy wrote: > On 8/29/2019 10:16 AM, Eryk Sun wrote: > >> In Windows, isatty() is true for any character-type file. > > Does that mean one that can either send or receive data a character at a > time, as opposed to a block at a time? Yes, any number of by

Re: if STREAM.isatty():

2019-08-30 Thread Eryk Sun
On 8/30/19, Eryk Sun wrote: > > GetFileType classifies files for all of the following NT device types > as FILE_TYPE_DISK (akin to Unix S_IFBLK): To clarify, file-system files and directories in a mounted file system on such as device are akin to Unix S_IFREG and S_IFDIR. Their fil

Re: if STREAM.isatty():

2019-08-30 Thread Eryk Sun
On 8/30/19, Chris Angelico wrote: > On Sat, Aug 31, 2019 at 2:26 AM Michael Torrie wrote: >> On Fri, Aug 30, 2019, 05:02 Hongyi Zhao > >>> Because without using sleep, the stuff on screen will display very >>> shortly and then disappear. Is this not your testing result? >> >> No it is not. What

Re: if STREAM.isatty():

2019-08-30 Thread Eryk Sun
On 8/30/19, Chris Angelico wrote: > On Sat, Aug 31, 2019 at 5:40 AM Eryk Sun wrote: > >> Or simply run python.exe from another console process that keeps the >> console alive (it's reference counted), which is typically cmd.exe or >> powershell.exe. > > N

Re: if STREAM.isatty():

2019-08-30 Thread Eryk Sun
On 8/30/19, Chris Angelico wrote: > On Sat, Aug 31, 2019 at 7:42 AM Eryk Sun wrote: > >> In Windows 8+, a process attaches to a console by opening >> "\Device\ConDrv\Connect" as a connection to an instance of the console >> host process, conhost.exe. T

Re: Issue About Install pyinstaller

2019-09-02 Thread Eryk Sun
On 9/1/19, Mehmet Furkan ÇOLAK wrote: > > I did “cmd > pip install pyinstaller > enter” > > from C:\Users\Furkan ÇOLAK\AppData\Local\Programs\Python\Python37-32 > but there isnt Script folder. > > İn cmd I see this kind of ERROR > 'pip' is not recognized as an internal or external command, > opera

Re: "Edit With Python" option missing

2019-09-02 Thread Eryk Sun
On 8/31/19, Akash verma wrote: > "Edit With Python" option missing from message context when right clicked > with mouse . If you mean "Edit with IDLE", this means that you've changed the file association. It's no longer using the default "Python.File" program identifier (progid). Create an empty

Re: How python knows where non standard libraries are stored ?

2019-09-07 Thread Eryk Sun
On 9/7/19, ast wrote: > > Eg on my system, here is the content of sys.path: > > >>> import sys > >>> sys.path > ['', In the REPL, "" is added for loading modules from the current directory. When executing a script, this would be the script directory. > 'C:\\Users\\jean-marc\\Desktop\\python',

Re: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Eryk Sun
On 9/16/19, Hongyi Zhao wrote: > > What is the Difference Between quit() and exit() commands in Python? They're different instances of the Quitter class, which is available if site.py is imported (i.e. not with the -S command-line option). They're created by site.setquit(): def setquit():

Re: Obtain the file's path.

2019-09-18 Thread Eryk Sun
On 9/17/19, Cameron Simpson wrote: > > If you just want this for your running program's internals this may not > matter, but if you're recording the result somewhere then abspath might > get you a more "stable" path in the above scenario. If a path has ".." components, the abspath() result may be

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Eryk Sun
On 9/22/19, Albert-Jan Roskam wrote: > > Do you think it's a deliberate design choice that decimal and thousands > where used here as params, and not a 'locale' param? It seems nice to be > able to specify e.g. locale='dutch' and then all the right lc_numeric, > lc_monetary, lc_time where used. Or

Re: Interesting performance question

2019-09-29 Thread Eryk Sun
On 9/29/19, Anthony Flury via Python-list wrote: > > Using python 3.6 building a tuple like this : > > my_tuple = tuple([x*x for x in range(1,1000)]) The list comprehension is implemented internally as a function that builds and returns the list. This function creates an empty list and loops over

Re: Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-09 Thread Eryk Sun
On 10/9/19, Malcolm Greene wrote: > > @Dan: Yes, symlinks would be a good work around. Assuming the file system supports symlinks (e.g. NTFS, but not FAT32), a relative symlink in the directory beside python.exe works fine, e.g. "python3.exe" -> "python.exe". Putting the symlink in another direct

Re: 3.7.4 (latest) install changes python to py and removes pip support

2019-10-11 Thread Eryk Sun
On 10/11/19, Jim Elphick wrote: > I upgraded my Python 3.7.3 windows install to 3.7.4 using the windows > download from python.org. > > After the install, the keyword "python" will no longer invoke python. > "python3" also fails. "py" is now the only access to python. "python3" would normally fa

Re: Odd delays when cwd is on a network mount

2019-10-11 Thread Eryk Sun
On 10/11/19, Cameron Simpson wrote: > > Python's default sys.path includes the current working directory. > (Worse: at the front!) Python normally sets the script directory at the front of sys.path to allow a script to override site paths and the standard library. If you're running the REPL, ther

Re: Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-11 Thread Eryk Sun
On 10/11/19, Gisle Vanem wrote: > > An "alias" could also simply be created using: >doskey python3=f:\ProgramFiles\Python36\python.exe That's a console alias [1], which gets evaluated by the console host process (conhost.exe) when the target process does a normal read via ReadConsoleW or Read

Re: Instantiating sub-class from super

2019-10-17 Thread Eryk Sun
On 10/17/19, Dennis Lee Bieber wrote: > On Wed, 16 Oct 2019 19:52:50 +0100, MRAB > declaimed the following: > >>Researchers find bug in Python script may have affected hundreds of >> studies >>https://arstechnica.com/information-technology/2019/10/chemists-discover-cross-platform-python-scripts-n

Re: Instantiating sub-class from super

2019-10-17 Thread Eryk Sun
On 10/17/19, MRAB wrote: > On 2019-10-17 20:06, Eryk Sun wrote: > >> I'm bugged by how the article mis-characterizes the fundamental >> problem. The operating system has nothing to do with the order of a >> directory listing, which varies even with an OS, dependi

Re: python2 vs python3

2019-10-21 Thread Eryk Sun
On 10/21/19, Albert-Jan Roskam wrote: > On 18 Oct 2019 20:36, Chris Angelico wrote: > >> That's correct. The output of the command is, by default, given to you >> in bytes. > > Do you happen to know why this is the default? And is there a reliable way > to figure out the encoding? On posix, it's

Re: Win32api problems

2019-10-22 Thread Eryk Sun
On 10/22/19, Albert-Jan Roskam wrote: > On 22 Oct 2019 11:23, GerritM wrote: > >> ImportError: DLL load failed: The specified > procedure could not be >> found. Many of the PyWin32 extensions depend on pywintypesXX.dll, and some depend on pythoncomXX.dll. There's a post-installation script that

Re: return a ctypes object to C

2019-10-31 Thread Eryk Sun
On 10/30/19, Arnaud Loonstra wrote: > > I have a binding to access and create the C methods and structures so in > Python I can call the Zmsg() constructor. I now need to return this. > > My python test method is simply: > > def actor_test( *args, **kwargs): > print("test") > msg = Zmsg(

Re: permission denied using python 3.8

2019-11-05 Thread Eryk Sun
On 11/5/19, robin deatherage wrote: > > MS Windows uses a UAC User Control. So it is best to not add a package > to an Admin user on Windows. The OP would have to install Python in a location that that's inaccessible to standard users and add this directory to the system PATH. It's dysfunctional

Re: permission denied using python 3.8

2019-11-05 Thread Eryk Sun
On 11/5/19, robin deatherage wrote: > > MS Windows uses a UAC User Control. So it is best to not add a package > to an Admin user on Windows. The OP would have to install Python in a location that that's inaccessible to standard users and add this directory to the system PATH. It's dysfunctional

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Eryk Sun
On 11/6/19, Chris Angelico wrote: > > Yes, but even if it's not recorded as a timestamp but as an uptime > counter, that counter can be referenced against the current time in > UTC. A DST switch affects the displayed time, but not the internal > definition of "current time" (at least, not on Linux

Re: '%Y' in strftime() vs. strptime()

2019-12-29 Thread Eryk Sun
On 12/29/19, Johannes Bauer wrote: > x = d(1, 1, 1) > x.strftime("%Y-%m-%d") > '1-01-01' The default padding depends on the platform strftime. POSIX strftime [1] supports an extension of ISO C that allows specifying the "0" pad character and minimum field width, e.g. "%04Y-%02m-%02d".

Re: Problems with Python install on Windows 10

2020-01-13 Thread Eryk Sun
On 1/13/20, Mike Weaver wrote: > > I've tried downloading from https://www.python.org/downloads/windows/ > (the Windows x86-64 executable installer > ) > and running that. Again says it is installed - but it clearly isn't. Maybe you

Re: Clarification on Immutability please

2020-01-22 Thread Eryk Sun
On 1/21/20, Jon Ribbens via Python-list wrote: > > Whether we call the link between 'foo' and (1, 2) a pointer or a > reference is almost entirely irrelevant, the difference is essentially > meaningless. In programming terms, a "pointer" is always an address in memory, and, at least to me, the te

Re: Exceptions versus Windows ERRORLEVEL

2020-04-05 Thread Eryk Sun
On 4/3/20, Stephen Tucker wrote: > > Does an exception raised by a Python 3.x program on a Windows machine set > ERRORLEVEL? ERRORLEVEL is an internal state of the CMD shell. It has nothing to do with Python. If Python exits due to an unhandled exception, the process exit code will be 1. If CMD w

Re: Is there a difference between python

2020-04-05 Thread Eryk Sun
On 4/5/20, Malcolm Greene wrote: > Is there a difference between the following 2 ways to launch a console-less > script under Windows? > > python

Re: Behaviour of os.path.join

2020-05-28 Thread Eryk Sun
On 5/26/20, BlindAnagram wrote: > > But if I try to make the directory myself (as I tried first): > > join(base, '..\\..\\', 'build', '\\') > > I obtain: > > 'C:\\' > > The documentation says that an absolute path in the parameter list for > join will discard all previous parameters but '\\' is

Re: Behaviour of os.path.join

2020-05-28 Thread Eryk Sun
On 5/27/20, Chris Angelico wrote: > On Thu, May 28, 2020 at 7:07 AM BlindAnagram > wrote: >> You can define a path however you want but it won't change the fact that >> on Windows a path that ends in '\\' is inherently a path to a directory. > > Citation needed. See [MS-FSA] 2.1.5.1 Server Reque

Re: Behaviour of os.path.join

2020-05-28 Thread Eryk Sun
On 5/28/20, BlindAnagram wrote: > > Thank you for making the effort to answer a number of issues raaised in > this thread. I much appreciate your input. For a more practical POV, see the topic on "File System Navigation" [1] for the C++ standard API. In the C++ standard library, trailing slashe

Re: Behaviour of os.path.join

2020-05-28 Thread Eryk Sun
On 5/28/20, Roel Schroeven wrote: > Eryk Sun schreef op 28/05/2020 om 15:51: >> On 5/27/20, Chris Angelico wrote: >>> On Thu, May 28, 2020 at 7:07 AM BlindAnagram >>> wrote: >>>> You can define a path however you want but it won't change the fact >

Re: Is there some reason that recent Windows 3.6 releases don't included executable nor msi installers?

2020-05-29 Thread Eryk Sun
On 5/28/20, Adam Preble wrote: > > We had found what looked like a bug in the Python Launcher where it would > eat command line arguments meant for the script. I would find some stuff > missing from sys.argv in a script that just imports sys and prints out > sys.argv if I ran it directly in cmd.ex

Re: why same ctypes code runs on win7, but not on win10?

2020-06-19 Thread Eryk Sun
On 6/19/20, oyster wrote: > The attachment is a very simple code that uses the DLL from > https://github.com/ying32/govcl to create a GUI application. The code > runs on my python 3.6.10 64 bits with win7 64 bits, but failed on my > python 3.6.10 64 bits and python 3.7.5 with win10 64 bits, by say

Re: Is sys.executable not supposed to follow symlinks?

2020-07-26 Thread Eryk Sun
On 7/26/20, Bolun Thompson wrote: > In the sys.executable documentation ( > https://docs.python.org/3/library/sys.html#sys.executable), they don't > specify if it follows symlinks. From my limited testing, it does not. Is > this behavior guaranteed? In Unix, the interpreter resolves the target of

Re: Windows and Subclassing - 'OverflowError': int too long to convert

2020-07-29 Thread Eryk Sun
On 7/28/20, Eko palypse wrote: > > Now when I get this error the message I receive in this situation is always > like this. > > hWnd=197364, msg=20, wParam=*18446744072652653190*, lParam=0 > > Traceback (most recent call last): > File "_ctypes/callbacks.c", line 237, in 'calling callback functio

Re: Winreg

2020-07-30 Thread Eryk Sun
On 7/30/20, R Pasco wrote: > access rights must be set to [winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY It's a bad practice to request more access than you require, at the very least because the request may fail with access denied for no good reason. KEY_ALL_ACCESS includes all applicable s

Re: Downloading Python

2020-08-02 Thread Eryk Sun
On 8/1/20, MRAB wrote: > On 2020-08-01 21:58, Barry wrote: >> On 31-7-2020 22:10, Tanmay Shah wrote: >>> >>> After downloading Python 3.8.5 IDLE, an error message popped up, >>> saying the code execution cannot proceed because python38.dll was >>> not found. What should I do in order to use the Py

Re: Program chaining on Windows

2020-08-23 Thread Eryk Sun
On 8/23/20, Rob Cliffe via Python-list wrote: > > Am I missing something? Is there a way in Windows for one Python > program to "chain" to another (or indeed to any executable) without > waiting for the latter to finish? Windows does not implement anything equivalent to the POSIX exec family of

Re: Program chaining on Windows

2020-08-23 Thread Eryk Sun
On 8/23/20, Chris Angelico wrote: > On Mon, Aug 24, 2020 at 7:40 AM dn via Python-list > >> As a 'general rule', isn't exec() something to be avoided? > > Nope, it's a very important tool. Not for every situation, of course, > but there are plenty of times when it's the right thing to do. In POSI

Re: Program chaining on Windows

2020-08-24 Thread Eryk Sun
On 8/24/20, Rob Cliffe wrote: > > Are you suggesting something I could do in Python that would achieve my > aim of *replacing* one program by another No, it's not possible with the Windows API. Implementing POSIX exec would require extensive use of undocumented NT runtime library functions, syste

Re: stat_result.st_ino from os.stat isn't constant on a network drive.

2020-08-26 Thread Eryk Sun
On 8/25/20, Andrew Nelson wrote: > > st_ino is supposed to "uniquely identify the file for a given value of > st_dev." That assurance only applies to POSIX systems, not Windows. st_ino is the file ID in Windows. Some filesystems do not support reliable file IDs, if any at all. I would only rely

Re: Symlinks already present

2020-09-01 Thread Eryk Sun
On 9/1/20, Chris Angelico wrote: > > Also, even if all that could be solved, I don't like the idea that > reading the same directory from two different sources leads to > different results. Is it really the same directory if reading it in > different ways gives different results? What's your take

Re: Symlinks already present

2020-09-01 Thread Eryk Sun
On 9/1/20, Chris Angelico wrote: > On Wed, Sep 2, 2020 at 4:55 AM Eryk Sun wrote: > >> "test2/spam" is a bind mount for "test1/spam", and note that `mount >> --bind` in Linux is a namespace operation, i.e. it's not a new device: >> >> &g

Re: Symlinks already present

2020-09-03 Thread Eryk Sun
On 9/3/20, Greg Ewing wrote: > On 2/09/20 6:55 am, Eryk Sun wrote: >> According to POSIX (st_dev, st_ino), it's the same directory, yet the >> ".." entry evaluates depending on the path parsing context: >> >> >>> os.lstat('test1/s

Re: Python 3.8.5 Not Launching

2020-09-23 Thread Eryk Sun
On 9/23/20, yehudis...@gmail.com wrote: >It’s a py file with simple python code If .py files are associated with py.exe or python.exe, then running a .py script either inherits or allocates a console and attaches to it. The console closes automatically as soon as the last reference to it clos

Re: Can't install Python

2020-09-28 Thread Eryk Sun
On 9/28/20, Dennis Lee Bieber wrote: > > Python is not a GUI. You do not "click on the phyton.exe file" (sic). > You open a command shell and, in a proper install which sets up the PATH > environment variable, enter "python" as the command to execute. You can run python.exe directly from Ex

Re: pip update fails

2020-09-28 Thread Eryk Sun
On 9/28/20, Dennis Lee Bieber wrote: > On Sun, 27 Sep 2020 05:33:14 +0300, "Hylton" > declaimed the following: > >> "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\ >> distlib\scripts.py", line 386, in _get_launcher > >

Re: Problem

2020-09-30 Thread Eryk Sun
On 9/30/20, Dennis Lee Bieber wrote: > On Tue, 29 Sep 2020 22:31:18 + (UTC), Ron Villarreal via Python-list > declaimed the following: > >>Tried to open Python 3.8. I have Windows 10. Icon won’t open. > > What "Icon"? > > Python is a language interpreter/compiler -- it runs from a

Re: Problem

2020-09-30 Thread Eryk Sun
On 9/30/20, Mirko via Python-list wrote: > > I have only limited knowledge about current Windows systems. But it > seems to me that newcomers download some setup exe/msi and then > search the menu to run what ever is found (python.exe or even the > setup-program.) It might help some people who tr

Re: Python 3.8.5 Not Launching

2020-10-02 Thread Eryk Sun
On 10/2/20, Gertjan Klein wrote: > Eryk Sun wrote: > >> If .py files are associated with py.exe or python.exe, then running a >> .py script either inherits or allocates a console and attaches to it. > > Is it possible to determine, from within Python, whether Python >

Re: Error 0xc000007b on opening python

2020-10-02 Thread Eryk Sun
On 10/2/20, Nipur Gupta wrote: > I've downloaded python 3.6.0 64 bits but whenever I try to open idle, it Python 3.8 supports Windows 8.1, so, unless otherwise required, you should install the latest release of 64-bit Python 3.8, which is currently 3.8.6: https://www.python.org/ftp/python/3.8.6/

Re: Python 3.8.5 Not Launching

2020-10-03 Thread Eryk Sun
On 10/3/20, Gertjan Klein wrote: > > I tried to find out what happens, using your other code: > > >>> import win32con, win32api > >>> access = win32con.PROCESS_QUERY_LIMITED_INFORMATION > >>> hproc = win32api.OpenProcess(access, False, pid) > >>> executable = win32process.GetModuleFileNameEx(h

Re: Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Eryk Sun
On 10/13/20, Tony Flury via Python-list wrote: > I am trying to write a simple expression to build a raw string that ends > in a single backslash. My understanding is that a raw string should > ignore attempts at escaping characters but I get this : > > >>> a = r'end\' >File "", line

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

2020-10-16 Thread Eryk Sun
On 10/16/20, Steve wrote: > -Original Message- > From: Python-list On > Behalf Of Frank Millman > Sent: Friday, October 16, 2020 4:34 AM > To: python-list@python.org > Subject: Re: How do I get datetime to stop showing seconds? > > On 2020-10-16 9:42 AM, Steve wrote: >> d2 = datetime.dat

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Eryk Sun
On 10/19/20, Grant Edwards wrote: > On 2020-10-19, Stephen Tucker wrote: > >> For a neatish way to get a string to end with a single backslash, how >> about >>mystr = r"abc\ "[:-1] >> (Note the space at the end of the rough-quoted string.) > > That's the first thing I thought of, though I wou

Re: Environment vars

2020-11-25 Thread Eryk Sun
On 11/25/20, Bob van der Poel wrote: > I've got a program which accepts an optional env variable listing a single > or multiple directory for the app to use. In Unix one would use colon as the preferred delimiter. In Windows, it's a semicolon because DOS paths use colon to designate drives. Pytho

Re: Environment vars

2020-11-25 Thread Eryk Sun
On 11/25/20, Bob van der Poel wrote: > > Ahha! Didn't know about os.pathsep. Seems simple enough to use that and be > done with it. > > I'm just using str.split() just now. Is there a os.splitpath()? I don't see > anything in the docs. There are no platform standard rules to follow when splitting

Re: A problem with opening a file -- again

2020-11-29 Thread Eryk Sun
On 11/29/20, Chris Angelico wrote: > > This seems like a really REALLY bad idea. You're putting a lot of work > into your __del__ function, and that's not getting called until > everything's shutting down. (Also, xrange doesn't exist, hence the > "exception ignored" thing.) > > Avoid putting this

Re: help

2021-01-01 Thread Eryk Sun
On 1/1/21, Sibylle Koczian wrote: > > But that doesn't help, if the script raises an exception. In that case > the input() call won't be reached and the window will close anyway > before you could see anything. And in a script with errors that's even > worse. Same effect with the "run" window. Th

Re: Does windows edit .py file shebangs?

2021-01-01 Thread Eryk Sun
On 1/1/21, Barry Scott wrote: > I found python scripts have had their shebang lines edited behind my back. > > The shebang line I'm seeing is: > > #!C:\Users\barry\AppData\Local\Microsoft\WindowsApps\python3.EXE > > Is this Microsoft being "helpful"? > Does anyone know what I will have done to

Re: Does windows edit .py file shebangs?

2021-01-03 Thread Eryk Sun
On 1/3/21, Barry Scott wrote: > > I've been doing some more investigation and found that the change happened > at 01/01/2021 16:16. The shebang is pointing to a 0 length PYTHON3.EXE. The files in "%LocalAppData%\Microsoft\WindowsApps" are AppExec reparse points. NT filesystem reparse points are a

Re: How does one write a function that increments a number?

2005-06-24 Thread sun . aries
Hi, please refer to the sections about the augments passing in Python tutorial. Python’s pass-by-assignment scheme isn’t the same as C++’s reference parameters, but it turns out to be very similar to C’s arguments in practice:  Immutable arguments act like C's "by value" mode. Objects such a

Re: Consecutive Character Sequences

2005-07-14 Thread Aries Sun
f hasConsequent(aString, minConsequent): for ch in aString: result = findall(ch*minConsequent, aString) if len(result) >= 1: return True return False >>> hasConsequent(s, 2) True >>> hasConsequent(s, 3) True >&g

Re: Consecutive Character Sequences

2005-07-14 Thread Aries Sun
Hi George, I used Python 2.4.1, the following are the command lines. But the reslut was still False. Is there anything wrong with below codes? >>> import itertools as it >>> def hasConsequent(aString, minConsequent): for _,group in it.groupby(aString): if len(list(group)) >

Re: Consecutive Character Sequences

2005-07-14 Thread Aries Sun
Hi George, Here's the result: >>> [list(group) for _,group in it.groupby("taaypiqee88adbbba")] [['t'], ['a', 'a'], ['y'], ['p'], ['i'], ['q'], ['e', 'e'], ['8', '8'], ['a'], ['d'], ['b', 'b', 'b'], ['a']] >>> [len(list(group)) for _,group in it.groupby("taaypiqee88adbbba")] [1, 2, 1, 1, 1, 1, 2, 2

Re: Is vars() the most useless Python built-in ever?

2015-11-30 Thread eryk sun
On Mon, Nov 30, 2015 at 7:00 PM, Steven D'Aprano wrote: > Either way, vars() doesn't solve the problem. What problem does it solve? vars() used to be the way to list local variables. >From 4 May 1994, Python 1.0.2 [1]: vars() returns a dictionary containing the local variables; vars(m)

Re: Is vars() the most useless Python built-in ever?

2015-12-02 Thread eryk sun
On Wed, Dec 2, 2015 at 3:28 AM, Chris Angelico wrote: > On Wed, Dec 2, 2015 at 7:22 PM, Serhiy Storchaka wrote: >> >> I use vars() exclusively for introspection in interactive environment. As >> well as dir() and help(). Sad that it doesn't work with __slots__. > > Maybe the upshot of all this is

Re: Unicode failure

2015-12-05 Thread eryk sun
On Sat, Dec 5, 2015 at 12:10 AM, Chris Angelico wrote: > On Sat, Dec 5, 2015 at 5:06 PM, Terry Reedy wrote: >> On 12/4/2015 10:22 PM, Random832 wrote: >>> >>> On 2015-12-04, Terry Reedy wrote: Tk widgets, and hence IDLE windows, will print any character from \u to \u witho

Re: Unicode failure

2015-12-05 Thread eryk sun
On Sat, Dec 5, 2015 at 4:03 PM, Terry Reedy wrote: > On 12/5/2015 2:44 PM, Random832 wrote: >> As someone else pointed out, I meant that as a list of codepages >> which support all Unicode codepoints, not a list of codepoints >> not supported by Tk's UCS-2. Sorry, I assumed everyone knew >> offha

Re: cannot open file with non-ASCII filename

2015-12-14 Thread eryk sun
On Mon, Dec 14, 2015 at 10:24 AM, Ulli Horlacher wrote: > With Python 2.7.11 on Windows 7 my users cannot open/read files with > non-ASCII filenames. [...] > c = msvcrt.getch() This isn't an issue with Python per se, and the same problem exists in Python 3, using either getch or getwch. Micro

Re: cannot open file with non-ASCII filename

2015-12-14 Thread eryk sun
On Mon, Dec 14, 2015 at 4:17 PM, Ulli Horlacher wrote: > > ImportError: No module named pyreadline > > Is it a python 3.x module? > > I am limited to Python 2.7 pyreadline is available for 2.7-3.5 on PyPI. Anyway, I tried it to no avail. When dropping a file path into the console it ignores the a

Re: cannot open file with non-ASCII filename

2015-12-14 Thread eryk sun
On Mon, Dec 14, 2015 at 6:07 PM, Laura Creighton wrote: > In a message of Mon, 14 Dec 2015 23:41:21 +0100, "Thomas 'PointedEars' Lahn" > wr > ites: > >>Why do you have to use msvcrt? >> >>I would use curses for user input, but: >> >>,-

Re: cannot open file with non-ASCII filename

2015-12-15 Thread eryk sun
On Tue, Dec 15, 2015 at 2:26 AM, Ulli Horlacher wrote: > Laura Creighton wrote: > >> PyPy wrote its own pyreadline. >> You can get it here. https://bitbucket.org/pypy/pyrepl > > As far as I can see, it has no getkey function. > My users do not hit ENTER after drag&drop or copy&paste files. > I ne

Re: cannot open file with non-ASCII filename

2015-12-16 Thread eryk sun
On Tue, Dec 15, 2015 at 11:04 AM, Ulli Horlacher wrote: > > Ehhh... I started Python programming some weeks ago and I know nearly > nothing about Windows. I am a UNIX and VMS guy :-) You should feel right at home, then. The Windows NT kernel was designed and implemented by a team of former DEC en

Re: Problem on ctypes arguments in a DLL function

2015-12-18 Thread eryk sun
On Fri, Dec 18, 2015 at 2:41 AM, wrote: > ValueError: Procedure probably called with too many arguments (4 bytes in > excess The function's calling convention is x86 cdecl (CDLL, caller stack cleanup), but you're using the x86 stdcall convention (WinDLL, callee stack cleanup). For a 64-bit proc

Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-18 Thread eryk sun
On Fri, Dec 18, 2015 at 3:51 AM, Steven D'Aprano wrote: > On Fri, 18 Dec 2015 11:02 am, Mark Lawrence wrote: > >> A lot of it is down to Windows, as the actual complaint is:- >> >> six.print_(source) > > Looks like a bug in six to me. > > See, without Unicode comments in the std lib, you neve

Re: (Execution) Termination bit, Alternation bit.

2015-12-20 Thread eryk sun
On Sun, Dec 20, 2015 at 10:21 AM, Dennis Lee Bieber wrote: > On Sun, 20 Dec 2015 12:25:30 +0100, "Skybuck Flying" > declaimed the following: >> >>This does make me wonder how Windows 7 terminates threads/processes/hanging >>applications. >> >>Apper

Re: IDLE 3.5.1 quits unexpectedly (portuguese keyboard)

2015-12-21 Thread eryk sun
On Fri, Dec 18, 2015 at 9:15 PM, Osvaldo Dias dos Santos wrote: > > Pressing the tilde key my iMac portuguese keyboard quits IDLE > unexpectedly (along with any associated files I may be working > on, including code). > > The keyboard image is attached. The tilde key is the second > orange one fro

Re:

2015-12-21 Thread eryk sun
On Mon, Dec 21, 2015 at 3:08 AM, Animesh Srivastava wrote: > While installin python3.5.1 i m getting 0xc07b error 0xC07B is STATUS_INVALID_IMAGE_FORMAT, so there's something wrong with the executable. Try clearing your browser cache and download the installer again. -- https://mail.pytho

Re: 0x80070570-The file or directory is corrupted and unreadable

2015-12-22 Thread eryk sun
On Tue, Dec 22, 2015 at 8:02 AM, muizz hasan wrote: > Hi there! I've been recently trying to install Python for Windows 10 > and I've been encountering some issues. Every time i try to install > the program it just says"0x80070570-The file or directory is corrupted > and unreadable". I have attach

Re: 0x80070570-The file or directory is corrupted and unreadable

2015-12-22 Thread eryk sun
On Tue, Dec 22, 2015 at 11:51 AM, Dennis Lee Bieber wrote: > > http://www.tech-faq.com/how-to-fix-error-0x80070570.html > suggests a registry cleaner (my preference over downloading some > unknown/unvetted "repair" tool) > > Most of the links on Google are for getting the error when installing > W

Re: Why doesn't os.remove work on directories?

2015-12-23 Thread eryk sun
On Tue, Dec 22, 2015 at 10:29 PM, Random832 wrote: > > This is surprising to anyone accustomed to the POSIX C remove > function, which can remove either files or directories. Is there > any known rationale for this decision? Guido added os.remove as a synonym for os.unlink in version 1.4 (1996)

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-23 Thread eryk sun
On Wed, Dec 23, 2015 at 7:16 AM, Nicky Mac wrote: > C:\Python\Python35\python.exe: Error while finding spec for > 'idlelib.__main__' (: bad magic number in 'idlelib': > b'\x03\xf3\r\n'); 'idlelib' is a package and cannot be directly executed 0xf303 (62211) is for Python 2.7. Make sure you don't h

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-23 Thread eryk sun
On Wed, Dec 23, 2015 at 8:38 AM, Nicky Mac wrote: > > I removed the old python2.7 entries in system Path, the PYTHON variables you > mentioned are not present. > All I have is Python35 in the PATH. Maybe there's still a stale directory on sys.path for another reason. Print sys.path from the comma

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-23 Thread eryk sun
On Wed, Dec 23, 2015 at 1:51 PM, Nicky Mac wrote: > > no sign of old Py2.7 anywhere :- > > C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')" > > C:\Python\Python35\python35.zip > C:\Python\Python35\DLLs > C:\Python\Python35\lib > C:\Python\Python35 > C:\Python\Python35\lib\site-pack

Re: What interface is a ‘Popen.stdout’ presenting?

2015-12-23 Thread eryk sun
On Wed, Dec 23, 2015 at 7:36 PM, Ben Finney wrote: > So how do I get from a Python 2 ‘file’ object, to whatever > ‘io.TextIOWrapper’ wants? I would dup the file descriptor and close the original file. Then open the file descriptor using io.open: >>> p = subprocess.Popen(['uname'], stdout=sub

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread eryk sun
On Thu, Dec 24, 2015 at 5:06 AM, Nicky Mac wrote: > > not sure what you mean by "my profile". > following your suggestion, looks normal: I meant your profile directory, "C:\Users\Nick". But printing the package path showed the problem is in your Python 3 installation itself. > C:\Users\Nick> pyt

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread eryk sun
On Thu, Dec 24, 2015 at 8:52 AM, Nicky Mac wrote: > seems the user profile PATH is a registry entry, and was not updated when I > deinstalled Python2.7 > still haven't figured out how to change it - I will NOT attempy a regedit. I don't use the option to add the installation and Scripts directo

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread eryk sun
On Thu, Dec 24, 2015 at 8:52 AM, Nicky Mac wrote: > seems the user profile PATH is a registry entry, and was not updated when I > deinstalled Python2.7 > still haven't figured out how to change it - I will NOT attempy a regedit. As to PATH on Windows, it's split into system and user components,

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread eryk sun
On Thu, Dec 24, 2015 at 3:29 PM, Nicky Mac wrote: > > C:\Users\Nick>python -m idlelib > ** IDLE can't import Tkinter. > Your Python may not be configured for Tk. ** In the 3.5 installation directory, ensure that tkinter is installed in Lib/tkinter. There should be an "__init__.py" and several oth

Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread eryk sun
On Thu, Dec 24, 2015 at 4:33 PM, Terry Reedy wrote: >> somehow the new py3.5 has been added to the end, not the beginning. >> guess this path is what you meant by "my profile". > > Bizarre. I just installed 3.5.1 on top of 3.5.1rc1, on Win10 with the 64bit > .exe installer, and the 3.5 dirs are a

<    1   2   3   4   5   6   7   >