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'

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 that's

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 the

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 link

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 > \LocalCache\local-packages\Python310\site-package

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 launc

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

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

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 though

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 embed

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 -- https://mail.python

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 relativel

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? > > func.argtypes=[ctypes.c_void_p,ctyp

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

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 Py

Re: How to flush 's stdout stream?

2021-01-15 Thread Eryk Sun
On 1/15/21, Grant Edwards wrote: > In Python 3.7+, how does one flush the stdout FILE stream? I mean the > FILE *declared as 'stdio' in . I'm _not_ asking how to flush the > Python file object sys.stdio. You can flush all output streams via C fflush(NULL). If it has to be just stdout, the code wi

Re: Exploring terminfo

2021-01-16 Thread Eryk Sun
On 1/16/21, Greg Ewing wrote: > On 17/01/21 12:40 pm, Chris Angelico wrote: >> This is true. However, at some point, the boundary is crossed from >> Python into the C library. Something, at that point, knows. It's very >> common to have a flush option available, so it should be used. > > I'm wonde

Re: Venv behaviour change py3.9

2021-02-15 Thread Eryk Sun
On 2/15/21, Abdur-Rahmaan Janhangeer wrote: > > I downloaded Python 3.9 yesterday, added the root folder to path > renamed python.exe to py39.exe and did > py39 -m venv venv > the output was > No such file or directory but i dont remember the exact phrase Probably you downloaded the embedded dist

Re: error on os.open API

2021-04-06 Thread Eryk Sun
On 4/5/21, Rami Khaldi wrote: > > It seems that the os.open API cannot distinguish between a permission error > and the fact that a directory cannot be opened like files. > The following script reproduces the scenario (tested on Python 3.8.2 > (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.19

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Eryk Sun
On 4/14/21, Quentin Bock wrote: > > this is the only part of the code that causes the error > > file = open('Egils Saga 1-15.txt', "r") Here's an app_abspath() function to resolve a filename against the directory of the main script: import os import sys def get_main_file():

Re: c-types Structure and equality with bytes/bytearray

2021-04-29 Thread Eryk Sun
On 4/26/21, Michael Hull wrote: > > my understanding was that `bytes` and `bytearray` would normally > be expected to work quite interchangeably with each other? bytearray.__eq__() is more flexible: >>> i = Int16(first=65, second=66) >>> bytearray(i).__eq__(i) True >>> i.__eq__(

Re: Definition of "property"

2021-05-30 Thread Eryk Sun
On 5/30/21, Ethan Furman wrote: > > > Properties are a special kind of attribute. Basically, when Python > encounters the following code: > > > > spam = SomeObject() > > print(spam.eggs) > > > > it looks up eggs in spam, and then examines eggs to see if it has a > __get__, __set__, o

Re: Definition of "property"

2021-06-01 Thread Eryk Sun
On 6/1/21, Jon Ribbens via Python-list wrote: > > I already answered that in the post you are responding to, but you > snipped it: You can tell something's definitely not a data attribute > if you have to put brackets after its name to call it as a method to > invoke its function or retrieve the v

Re: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

2021-06-07 Thread Eryk Sun
On 6/6/21, pjfarl...@earthlink.net wrote: > > On a Windows 10 platform (python 3.8.9 and 3.9.5), how do I use ctypes to > access an array of uint32_t's exported from a DLL? > ... > __declspec(dllexport) extern uint32_t array_name[128]; A ctypes data type has an in_dll() method [1] that returns an

Re: curses apps on MS Windows?

2021-06-14 Thread Eryk Sun
On 6/13/21, Grant Edwards wrote: > > Are there examples of popular curses applications for Windows? I don't think are any popular examples. The port of the "nano" editor uses ncurses. https://github.com/lhmouse/nano-win IIRC, PDCurses has better support -- e.g. 256 colors and blinking under Win

Re: Can't get rid of old version of python

2021-08-13 Thread Eryk Sun
On 8/13/21, Ciarán Ó Duibhín via Python-list wrote: > > But when I type "python" at the DOS prompt, I get "Python 3.8.10". I > don't understand this, as I uninstalled old versions, and I do not see a > DOS environment variable called "python" anywhere. The app distribution is probably installed.

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Eryk Sun
On 8/16/21, Roel Schroeven wrote: > > We're not necessarily talking about the PC speaker here: (almost) all > computers these days have sound cards (mostly integrated on the > motherboard) that are much more capable than those one-bit PC speakers. Yes, the PC speaker beep does not get used in Win

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Eryk Sun
On 8/16/21, Chris Angelico wrote: > On Tue, Aug 17, 2021 at 11:44 AM Eryk Sun wrote: > >> Yes, the PC speaker beep does not get used in Windows 7+. The beep >> device object is retained for compatibility, but it redirects the >> request to a task in the user's ses

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-17 Thread Eryk Sun
On 8/17/21, Dennis Lee Bieber wrote: > On Tue, 17 Aug 2021 15:11:05 +1000, Chris Angelico > declaimed the following: > >>Huh. Okay. Then I withdraw the concern from this list, and instead lay >>it at Microsoft's feet. That is, I maintain, a bizarre choice. Surely >>there are better ways to trigge

Re: Explaining exec(globals, separate_locals)

2021-09-20 Thread Eryk Sun
On 9/20/21, Terry Reedy wrote: > > "If exec gets two separate objects as globals and locals, the code will > be executed as if it were embedded in a class definition." Note that, unlike exec(), the body of a class definition can modify closure variables in nonlocal function scopes. For example:

Re: Python added to PATH, cannot be directly accessed, cannot install pip

2021-09-27 Thread Eryk Sun
On 9/27/21, Will wrote: > >I am using a Lenovo Laptop using Windows. I'm trying to install >get-pip.py The installer includes pip by default and has an option to update PATH for you, though the latter isn't enabled by default. Latest 64-bit release: https://www.python.org/ftp/python/3.9.

Re: Python added to PATH, cannot be directly accessed, cannot install pip

2021-09-27 Thread Eryk Sun
On 9/27/21, Mats Wichmann wrote: > > pip, meanwhile, is not in the same directory as the python executable, > so even "adding python to PATH" doesn't solve the problem of running > pip. Invoke it like this instead: The installer's option to add Python to PATH adds both the installation directory

Re: python39.dll not found

2021-10-01 Thread Eryk Sun
On 10/1/21, Sravan Kumar Chitikesi wrote: > You might copy the installation files from one to another computer, but you > missed the copying pytho**.dll from from windows/system32 folder.> The PSF installer 3.4 and earlier installs "pythonXY.dll" in the system directory when it peforms an all-use

Re: [tkinter][Windows]Unexpected state report for the tab key

2021-10-24 Thread Eryk Sun
On 10/24/21, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>tab_down_hllDll.GetKeyState(tab_down_VK_TAB) & 0b1000 > > In the meantime, I read about "GetAsyncKeyState". I thought that > this would solve my problem, but no. Odd. It works for me in the classic con

Re: Avoid nested SIGINT handling

2021-11-13 Thread Eryk Sun
On 11/12/21, Mladen Gogala via Python-list wrote: > On Thu, 11 Nov 2021 17:22:15 +1100, Chris Angelico wrote: > >> Threads aren't the point here - signals happen immediately. > > [snip: description of POSIX signals] > > BTW, that's the case on both Unix/Linux systems and Windows systems. Windows

Re: Unable to compile my C Extension on Windows: unresolved external link errors

2021-11-15 Thread Eryk Sun
On 11/14/21, Marco Sulla wrote: > On Sun, 14 Nov 2021 at 16:42, Barry Scott wrote: > >> On macOS .dynlib and Unix .so its being extern that does this. > > And extern is the default. I understand now. Per Include/exports.h and Include/pyport.h, Python should be built in

Re: several issues with pyinstaller on Windows 10

2021-11-18 Thread Eryk Sun
On 11/18/21, Ulli Horlacher wrote: > > P:\W10\dist>argv a b > The process cannot access the file because it is being used by another > process. Try searching for open handles for "argv.exe" using Sysinternals Process Explorer [1]. Terminate the offending process. Since you're inexperienced with

Re: Using PIP in Python 3.10 on Windows 10

2022-01-14 Thread Eryk Sun
On 1/14/22, Mats Wichmann wrote: > On 1/14/22 10:40, Jonathan Gossage wrote: > > By this do you mean the python.org installer or the Microsoft Store > installer - they're similar but have some differences. Jonathan is not using the store app. The store app is installed to the system in "%ProgramF

Re: About Python Compressed Archive or Binaries

2022-01-18 Thread Eryk Sun
On 1/17/22, Sina Mobasheri wrote: > > I'm aware that Python also have something called Embedded Zip for Windows > and nothing like that for Linux as far as I know, and I think this Embedded > Zip is not something that the user wants to work with that directly it's for > embedding in a C++ applicat

Re: Openning Python program

2022-02-06 Thread Eryk Sun
On 2/6/22, Dennis Lee Bieber wrote: > > NOTE: there may be a "launcher" installed that is supposed to find Python > without requiring one to edit the system PATH environment variable -- but I > tend to avoid it: M$ and some other applications seem to keep hijacking > which Python gets priority, an

Re: Global VS Local Subroutines

2022-02-10 Thread Eryk Sun
On 2/10/22, BlindAnagram wrote: > > This is exactly what I felt too but I then wondered if the code was > recreated dynamically or was static with just a reference being created > on each invocation of the parent. The overhead in this case would be > negligible. But then I thought 'what about the

Re: ERROR IN DOWNLOADING PYTHON

2022-02-15 Thread Eryk Sun
On 2/15/22, 11_Anindita Das_BCA wrote: > > I have downloaded the latest 3.10.2 version of python for my 64×64 bit > laptop but I'm unable to work on it as my system is showing that > api-ms-win-crt-runtime-l1-1-0-dll is missing but it's not the case as i > have also downloaded this file. I guess

Re: venv and executing other python programs

2022-02-15 Thread Eryk Sun
On 2/15/22, Martin Di Paola wrote: > > That's correct. I tried to be systematic in the analysis so I tested all > the possibilities. Your test results were unexpected for `python3 -m venv xxx`. By default, virtual environments exclude the system and user site packages. Including them should requi

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Eryk Sun
On 2/20/22, Abdur-Rahmaan Janhangeer wrote: > > Out of curiosity, why doesn't Python accept > def (): > return '---' The `def` keyword is compiled as an assignment statement, not an expression that evaluates anonymously on the stack. Using `def` as an expression would require new syntax. For

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Eryk Sun
On 2/20/22, Greg Ewing wrote: > > BTW, this is not what is usually meant by the term "anonymous > function". An anonymous function is one that is not bound > to *any* name. The thing you're proposing wouldn't be > anonymous -- it would have a name, that name being the empty > string. Sorry. I rea

Re: Compiling and Linking pre-built Windows Python libraries with C++ files on Linux for Windows

2022-03-19 Thread Eryk Sun
On 3/18/22, Ankit Agarwal wrote: > Hi, > > This is a very specific question. I am trying to figure out whether or not > I can use pre-built python libraries and headers on Windows in a MinGW > build on Linux. Essentially I have some python and C++ code which interface > via cython and pybind. I wa

Re: ctypes And The WACAH Principle

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 1:45 AM, Lawrence D’Oliveiro wrote: > > Ah, I wish... I had a look at the documentation for the buffer interface and > memory views, > and found no way to make use of them from pure Python. Basically, the > paragraph I quoted > above is wrong in just about every important

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 4:46 AM, wrote: > > i have installed python 3.5 , but the python command is not recognized > > C:\Users\sharmaaj>python > 'python' is not recognized as an internal or external command, > operable program or batch file. > > what should i do to run python commands. Modify y

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 1:46 PM, BartC wrote: > On 10/08/2016 11:34, eryk sun wrote: >> >> On Wed, Aug 10, 2016 at 4:46 AM, wrote: >>> >>> i have installed python 3.5 , but the python command is not recognized >>> >>> C:\Users\sharmaaj>p

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 2:03 PM, Random832 wrote: > On Wed, Aug 10, 2016, at 06:34, eryk sun wrote: >> On Wed, Aug 10, 2016 at 4:46 AM, wrote: >> > >> > i have installed python 3.5 , but the python command is not recognized >> > >> > C:\Users\sharm

Re: ctypes And The WACAH Principle

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 10:26 PM, Lawrence D’Oliveiro wrote: > But it has to copy the bytes into an array.array object, then decode that. Is > there a way it > could access the bytes memory directly? ctypes cast, string_at, wstring_at, memmove, and memset are implemented as FFI calls. Since ctyp

Re: Win32 API in pywin32

2016-08-13 Thread eryk sun
On Sat, Aug 13, 2016 at 4:22 AM, Lawrence D’Oliveiro wrote: > On Friday, August 5, 2016 at 11:58:05 AM UTC+12, I wrote: >> >> Are people still using Win32? I thought Windows went 64-bit years ago. > > Here > is a little titbi

Re: Good Tutorial for Python3 winreg Module

2016-08-20 Thread eryk sun
On Sun, Aug 21, 2016 at 3:55 AM, wrote: > > I need to pull a saved value from the registry, and the only way I > know how to get it is through winreg. Here's an example that reads the value and type of "Temp" in HKCU\Environment: import winreg

Re: Does This Scare You?

2016-08-21 Thread eryk sun
On Sun, Aug 21, 2016 at 8:03 PM, Michael Torrie wrote: > On 08/19/2016 05:42 PM, Lawrence D’Oliveiro wrote: >> Python 3.5.2+ (default, Aug 5 2016, 08:07:14) >> [GCC 6.1.1 20160724] on linux >> Type "help", "copyright", "credits"

Re: Does This Scare You?

2016-08-21 Thread eryk sun
On Mon, Aug 22, 2016 at 12:44 AM, Chris Angelico wrote: > "Trying to be" cross-platform? The point of these path modules is to > *be* cross-platform. I can't call Windows APIs on my Linux box (short > of messing around with VMs or Wine or something, which are > dependencies that Python doesn't nee

Re: Does This Scare You?

2016-08-21 Thread eryk sun
On Mon, Aug 22, 2016 at 1:26 AM, Chris Angelico wrote: > They're specifically documented as not touching any file system, which > means that they are cross-platform and cannot be guaranteed to be > perfect. If you know you're running on Windows, use WindowsPath > instead (trying to do so on a non-

Re: Does This Scare You?

2016-08-22 Thread eryk sun
On Mon, Aug 22, 2016 at 12:39 PM, Chris Angelico wrote: > > Nope. On Windows, you would try/except it. There are myriad other ways No, I would not rely on exceptions in this case. Both \\.\CON and \\.\NUL can be opened for both reading and writing, so you may not detect the problem. I think it's

Re: Does This Scare You?

2016-08-22 Thread eryk sun
On Mon, Aug 22, 2016 at 1:17 PM, Chris Angelico wrote: > I tried things like "con.txt" and it simply failed (no such file or > directory), without printing anything to the console. Are you using IDLE or some other IDE that uses pythonw.exe instead of python.exe? If so, first use ctypes to allocat

Re: The dangerous, exquisite art of safely handing user-uploaded files: Tom Eastman (was: Does This Scare You?)

2016-08-22 Thread eryk sun
On Mon, Aug 22, 2016 at 3:40 PM, Chris Angelico wrote: > Windows has some other issues, including that arbitrary files can > become executable very easily (eg if %PATHEXT% includes its file > extension), cmd uses PATHEXT to augment its search by appending each extension in the list, in addition t

Re: Does This Scare You?

2016-08-22 Thread eryk sun
On Mon, Aug 22, 2016 at 4:18 PM, Chris Angelico wrote: > >> The CON device should work if the process is attached to a console >> (i.e. a conhost.exe instance). > > No, I used Pike (to avoid any specifically-Python issues or > protections) running in a console. Attempting to write to "Logs/con" >

Re: Does This Scare You?

2016-08-24 Thread eryk sun
On Mon, Aug 22, 2016 at 5:24 PM, Chris Angelico wrote: > On Tue, Aug 23, 2016 at 3:13 AM, eryk sun wrote: >> On Mon, Aug 22, 2016 at 4:18 PM, Chris Angelico wrote: >>> >>>> The CON device should work if the process is attached to a console >>>> (i.e. a

Re: Does This Scare You?

2016-08-26 Thread eryk sun
On Fri, Aug 26, 2016 at 11:28 AM, Jon Ribbens wrote: > On 2016-08-24, Chris Angelico wrote: >> On Thu, Aug 25, 2016 at 7:00 AM, eryk sun wrote: >>> I discovered why "Logs/con.txt" isn't working right in Windows 7, >>> while "Logs/nul.txt" do

Re: Fatal Python error

2016-08-31 Thread eryk sun
On Wed, Aug 31, 2016 at 9:04 AM, Wanderer <864483...@qq.com> wrote: > The system environment I alse configured.The Sigil project also build > successed. > But When I run the Sigil.exe that follow errors occured. > -- > Fatal Python error: Py_Initialize: unable to load the file syst

Re: Does This Scare You?

2016-09-08 Thread eryk sun
On Thu, Sep 8, 2016 at 1:30 AM, Lawrence D’Oliveiro wrote: > On Monday, August 22, 2016 at 4:18:39 PM UTC+12, eryk sun wrote: >> It would help to consult a reverse-engineered implementation of >> RtlGetFullPathName_Ustr and RtlIsDosDeviceName_Ustr. I'll check the &g

Re: Where is the documentation for ','?

2016-09-16 Thread eryk sun
On Sat, Sep 17, 2016 at 2:05 AM, Peng Yu wrote: > > I'm wondering where is the documentation for ',' as in the following usage. > > x = 1 > y = 2 > x, y = y, x > > I tried help(','). But there are too many ',' in it and I don't see in > which section ',' is documented. Could anybody let me know? T

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 12:17 AM, Lawrence D’Oliveiro wrote: > > why does the documentation suggest that “i” and “I” could have an item size > of 2? SHRT_MAX <= INT_MAX <= LONG_MAX <= LLONG_MAX. short int and int ("h" and "i") are at least 16-bit. long i

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 3:55 AM, Chris Angelico wrote: > On Sun, Sep 18, 2016 at 1:16 PM, Lawrence D’Oliveiro > wrote: >> On Sunday, September 18, 2016 at 2:34:46 PM UTC+12, eryk sun wrote: >>> However, I see that MicroPython [1] has been ported to 16-bit >>> PIC m

Re: Is the content available in the html doc available in help()?

2016-09-17 Thread eryk sun
On Sun, Sep 18, 2016 at 3:26 AM, Steve D'Aprano wrote: > help() does *not* return the same documentation as on the website. The > website usually includes a lot more detail. > > The help() function introspects the python source code and formats the > docstrings found, so i

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread eryk sun
On Thu, Sep 22, 2016 at 5:12 AM, Veek M wrote: > 2. Blank lines in my code within the editor are perfectly acceptable for > readability but they act as a block termination on cmd line. You can write a simple paste() function. For example: import sys paste = lambda: exec(sys.stdin.read(),

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread eryk sun
On Thu, Sep 22, 2016 at 12:40 PM, Gregory Ewing wrote: > eryk sun wrote: >> >> Actually in a Unix terminal the cursor can also be at >> the end of a line, but a bug in Python requires pressing Ctrl+D twice >> in that case. > > I wouldn't call that a bug, rath

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread eryk sun
On Thu, Sep 22, 2016 at 3:21 PM, Random832 wrote: > On Thu, Sep 22, 2016, at 09:45, eryk sun wrote: > >> Yes, FileIO.readall continues making read() system calls until it sees >> an empty read. But if we know we're reading from a terminal, we should >> be able

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-26 Thread eryk sun
On Tue, Sep 27, 2016 at 1:48 AM, wrote: > This function is in a DLL. It's small but may run for days before complete. I > want it > takes 100% core usage. Threading seems not a good idea for it shares the core > with others. Will the multiprocessing module do it? The threads of a process do not

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-27 Thread eryk sun
On Wed, Sep 28, 2016 at 2:13 AM, wrote: > If the load was distributed by the OS schedules across all cores, > does it means I can't make one core solely running a piece of codes > for me and so I have no contol on its performance? In Unix, Python's os module may have sched_setaffinity() to set t

Re: Using the Windows "embedded" distribution of Python

2016-09-28 Thread eryk sun
On Wed, Sep 28, 2016 at 2:35 PM, Paul Moore wrote: > So I thought I'd try SetDllDirectory. That works for python36.dll, but if I > load > python3.dll, it can't find Py_Main - the export shows as "(forwarded to > python36.Py_Main)", maybe the forwarding doesn't handle SetDllDirectory? It works f

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread eryk sun
On Thu, Sep 29, 2016 at 8:35 AM, Paul Moore wrote: > PS It's a shame there's no way to put the embedded distribution in a > subdirectory > *without* needing to use dynamic loading, but I guess that's basically an OS > limitation. There are ways to do this. The simplest way is to use a subdirec

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread eryk sun
On Thu, Sep 29, 2016 at 10:41 AM, Paul Moore wrote: > On Thursday, 29 September 2016 10:39:10 UTC+1, eryk sun wrote: >> On Thu, Sep 29, 2016 at 8:35 AM, Paul Moore wrote: >> > PS It's a shame there's no way to put the embedded distribution in a >> > subdi

Re: filesystem encoding 'strict' on Windows

2016-09-30 Thread eryk sun
On Fri, Sep 30, 2016 at 5:58 AM, iMath wrote: > the doc of os.fsencode(filename) says Encode filename to the filesystem > encoding 'strict' > on Windows, what does 'strict' mean ? "strict" is the error handler for the encoding. It raises a UnicodeEncodeError for unmapped characters. For exampl

Re: Using the Windows "embedded" distribution of Python

2016-09-30 Thread eryk sun
On Fri, Sep 30, 2016 at 11:02 AM, Paul Moore wrote: > When I run ssh.exe, it fails with the message "The program cannot start > because > python3.dll is missing from your computer". I tried running it with sxstrace > active, > but the resulting log file is empty. A manifest embedded in "ssh.ex

Re: working with ctypes and complex data structures

2016-10-02 Thread eryk sun
On Sun, Oct 2, 2016 at 5:50 PM, Michael Felt wrote: > > a) where is documentation on "CField"'s? It's undocumented. A CField is a data descriptor that accesses a struct field with the given type, size, and offset. Like most descriptors, it's meant to be accessed

Re: Python 3.5 amd64 and win32service

2016-10-03 Thread eryk sun
On Mon, Oct 3, 2016 at 1:26 PM, Nagy László Zsolt wrote: > > Is it possible to write a win32 service with 64 bit python 3.5? The > pywin32 package does exist on 3.5 64bit, but missing some modules: Try pip installing the "pypiwin32" package. -- https://mail.python.org/mailman/listinfo/python-lis

Re: working with ctypes and complex data structures

2016-10-03 Thread eryk sun
On Mon, Oct 3, 2016 at 2:35 PM, Michael Felt wrote: > On 02-Oct-16 23:44, eryk sun wrote: >> On Sun, Oct 2, 2016 at 5:50 PM, Michael Felt >> wrote: >> >>> b) what I am not understanding - as the basic documentation shows >>> FOO.value as the way to set/g

Re: working with ctypes and complex data structures

2016-10-03 Thread eryk sun
On Mon, Oct 3, 2016 at 9:27 PM, Michael Felt wrote: > > int perfstat_subsystem_total( >perfstat_id_t *name, >perfstat_subsystem_total_t *userbuff, >int sizeof_struct, >int desired_number); > ... >+79 class cpu_total: >+80 def __init__(self): >+81 __perfst

Re: Python 3.5 amd64 and win32service

2016-10-04 Thread eryk sun
On Tue, Oct 4, 2016 at 7:33 AM, Nagy László Zsolt wrote: > >>> Is it possible to write a win32 service with 64 bit python 3.5? The >>> pywin32 package does exist on 3.5 64bit, but missing some modules: >> Try pip installing the "pypiwin32" package. > That worked, thanks. > > Do you have an explana

Re: Python 3.5 amd64 and win32service

2016-10-04 Thread eryk sun
On Wed, Oct 5, 2016 at 6:18 AM, Nagy László Zsolt wrote: > But again, that is not related to the question. Why does it not work? > What is missing? If you mean why running the service doesn't work, it should once you run the post-install script that copies pywintypes35.dll to the Windows System32

Re: Python 3.5 amd64 and win32service

2016-10-05 Thread eryk sun
On Wed, Oct 5, 2016 at 7:43 AM, Nagy László Zsolt wrote: > It did not help. I still get the same error message (service did not > respond in time). Can you run the service executable directly? From the command line check `sc qc TestService`. Run the BINARY_PATH_NAME executable, e.g. for /f "

Re: Problem with install of Python 3.5.2 on Windows Vista

2016-10-05 Thread eryk sun
On Wed, Oct 5, 2016 at 7:18 PM, Mike Adams wrote: > The install seemed to be going well up to near the end when I got the msg > 'Python > has stopped working', I clicked the button then I got the msg 'Setup was > successful'. > I then clicked 'IDLE' and it says it can't find > 'api-msi-win-crt-

Re: working with ctypes and complex data structures

2016-10-05 Thread eryk sun
On Wed, Oct 5, 2016 at 9:03 PM, Michael Felt wrote: > >> +80 args = (1, "name", None), (2, "buff", None), (1, "size", >> 0), (1, "count", 1) > > error #1. paramater type 2 (the buffer might be where data is being put, but > for the call, the pointer is INPUT) An output parameter (type 2)

Re: Python 3.5 amd64 and win32service

2016-10-06 Thread eryk sun
On Thu, Oct 6, 2016 at 5:23 AM, Nagy László Zsolt wrote: > "C:\Users\Laci\AppData\Local\Programs\Python\Python35\lib\site-packages\win32\PythonService.exe" I wanted you to run the above executable, not python.exe. If it fails you'll get more information about why it's failing when run directly th

Re: Doubled backslashes in Windows paths

2016-10-07 Thread eryk sun
On Fri, Oct 7, 2016 at 9:27 AM, Peter Otten <__pete...@web.de> wrote: > To fix the problem either use forward slashes (which are understood by > Windows, too) Using forward slash in place of backslash is generally fine, but you need to be aware of common exceptions, such as the following: (1) Pat

Re: Doubled backslashes in Windows paths

2016-10-07 Thread eryk sun
On Fri, Oct 7, 2016 at 10:46 AM, Steve D'Aprano wrote: > That's because > > "C: > > is an illegal volume label (disk name? I'm not really a Windows user, and > I'm not quite sure what the correct terminology here would be). It's not an illegal device name, per se. A DOS device can be defined

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread eryk sun
On Tue, Oct 11, 2016 at 10:34 AM, wrote: > I have two files in the Q:\lib directory: > > Q:\lib>dir > 2007/03/11 AM 08:025,260 lib_MARK.so > 2007/03/11 AM 08:024,584 lib_mark.so > > Under Python 3.4.4 I got: > f = open('lib_MARK.so', 'br') data = f.read() f.close(

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread eryk sun
On Wed, Oct 12, 2016 at 2:36 AM, wrote: > > I had try to find the document of the _winapi module, but can't find any in my > installed Python directory. Can you give me a link to look for? _winapi is not documented. It contains light wrappers around a small set of Windows functions. It's ok for

Re: an other issue when installing python under Windows OS

2016-10-12 Thread eryk sun
On Wed, Oct 12, 2016 at 12:24 PM, Karlheinz Hoening wrote: > >on my iMac I have installed Windows (7) and I am now trying to install >Python 3.5.2 (32-bit) under Windows OS. >Every time after having 'repaired' with the installation procedere I >receive the following message when st

Re: an other issue when installing python under Windows OS

2016-10-12 Thread eryk sun
On Wed, Oct 12, 2016 at 3:25 PM, eryk sun wrote: > On Wed, Oct 12, 2016 at 12:24 PM, Karlheinz Hoening wrote: >> >>on my iMac I have installed Windows (7) and I am now trying to install >>Python 3.5.2 (32-bit) under Windows OS. >>Every time after

<    1   2   3   4   5   6   7   >