Re: How to Add ANSI Color to User Response

2024-04-12 Thread Gisle Vanem via Python-list
Pierre Fortin wrote: Over the years, I've tried different mechanisms for applying colors until I got my hands on f-stings; then I created a tiny module with all the colors (cR, cG, etc) which made my life so much simpler (attached). Attachments are stripped off in this list. It would be nice

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

2023-06-09 Thread Gisle Vanem via Python-list
Dennis Lee Bieber wrote: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\Owner> Get-ChildItem -Path C:\Python310\ -Recurse -Name -Filter "pip.*" Tried it. Oh man what a slow process: sync

Re: Q: argparse.add_argument()

2023-03-18 Thread Gisle Vanem via Python-list
Thomas Passin wrote: So please, try to think out how your questions will seem to the reader, and be clear about what you are asking.  You may not know the terminology that some other people use, but don't let that stop you from being clear about what you really need to find out.  Including

Re: Q: argparse.add_argument()

2023-03-18 Thread Gisle Vanem via Python-list
Thomas Passin wrote: Are you trying to troll here? You just showed how you got an error with this construction, so why are you asking how to get an error with this construction? I meant (obviously), another error-message besides: error: unrecognized arguments: -cn Perhaps from

Q: argparse.add_argument()

2023-03-18 Thread Gisle Vanem via Python-list
I accidentally used 'argparse' like this in my Python 3.9 program: parser.add_argument ("-c, --clean", dest="clean", action="store_true") parser.add_argument ("-n, --dryrun", dest="dryrun", action="store_true") instead of: parser.add_argument ("-c", "--clean", dest="clean",

Re: pip issue

2022-11-30 Thread Gisle Vanem via Python-list
Dieter Maurer wrote: Otherwise no issues. But where is this text "-arkupsafe" stored and how to get rid it it? I've searched through all of my .pth files and found no such string. Have you looked at the content of the folder mentioned in the warnings (e.g. `...\site-packages`). I had 2

pip issue

2022-11-30 Thread Gisle Vanem via Python-list
Hello list. I have an issue with 'pip v. 22.3.1'. On any 'pip install' command I get warning like this: c:\> pip3 install asciinema WARNING: Ignoring invalid distribution -arkupsafe (f:\gv\python310\lib\site-packages) WARNING: Ignoring invalid distribution -arkupsafe

Re: Changing 'Scripts/*.exe'

2022-10-03 Thread Gisle Vanem via Python-list
dn wrote: E.g. 'Scripts/pip2.exe' has the path "f:\programfiler\python27\python.exe" hard-coded inside it. Is there a easy way to fix this w/o re-installing this old Python? Yes, by putting a symbolic-link at the old 'programfiler' location which points to the new 'gv' installation. I'm

Changing 'Scripts/*.exe'

2022-10-01 Thread Gisle Vanem via Python-list
Hello list. I'm moved my old Python27 installation from f:\ProgramFiler\Python27 ( == 'ProgramFiles') to f:\gv\Python27 and now many 'scripts/*.exe' program fails to start since the old path to 'Python.exe' is wrong. E.g. 'Scripts/pip2.exe' has the path

Re: Persistent Error: Python was not found

2022-08-15 Thread Gisle Vanem via Python-list
Eryk Sun wrote: If the redirector app is run without arguments, it will open the Microsoft Store to install the latest version of the Python store app distribution. Currently that means Python 3.10. That is true with cmd. But with a shell like 4NT, I get: c:\>

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

2022-04-22 Thread Gisle Vanem
Barry wrote: Tip “py.exe -0” will list the state of installed pythons. Not here; 'py.exe -0' gives: Requested Python version (0) not installed Which PyInstaller version support this '-0' option? -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: URLError:

2022-02-12 Thread Gisle Vanem
Shaozhong SHI wrote: The following is used in a loop to get response code for each url. print (urllib.request.urlopen(url).getcode()) However, error message says: URLError: 11001 == WSAHOST_NOT_FOUND. Look in any 'winsock.h' header: #define WSAHOST_NOT_FOUND (WSABASEERR+1001) -- --gv --

Re: Best way to check if there is internet?

2022-02-09 Thread Gisle Vanem
Abdur-Rahmaan Janhangeer wrote: It's a demo to get the idea behind, uses requests and the rich library. I'd never heard of 'Rich'. But d/l it and playing with it, I came up with this version with fat green spinner-bar: import requests from rich.console import Console def ensure_internet():

Re: Best way to check if there is internet?

2022-02-09 Thread Gisle Vanem
Abdur-Rahmaan Janhangeer wrote: Thanks everybody for the answers. It was very enlightening. Here's my solution: # using rich console def ensure_internet(): console = Console() domains = [ 'https://google.com', 'https://yahoo.com', 'https://bing.com', 'https://www.ecosia.org',

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

2021-11-12 Thread Gisle Vanem
Marco Sulla wrote: Error LNK2001: unresolved external symbol PyErr_SetObject and so on. I post the part of my setup.py about the C Extension: extra_compile_args = ["-DPY_SSIZE_T_CLEAN", "-DPy_BUILD_CORE"] Shouldn't this be "-DPy_BUILD_CORE_MODULE"? -- --gv --

Re: Create a real-time interactive TUI using Python.

2021-09-01 Thread Gisle Vanem
hongy...@gmail.com wrote: The following are some python TUI framework libraries/projects I have discovered so far: https://github.com/pfalcon/picotui https://github.com/peterbrittain/asciimatics https://github.com/bczsalba/pytermgui https://github.com/GeorgeFilipkin/pulsemixer

Re: "py.ini" question

2021-04-26 Thread Gisle Vanem
Ralf M. wrote: I think the problem / misunderstanding is that Gisle put in py.ini only  [defaults]  python=3.6 and expected this to make py -3 start 3.6. However py -3 looks for a key named 'python3' and, not finding it, uses default behaviour (ignoring the 'python' key), i.e. starts the

Re: "py.ini" question

2021-04-24 Thread Gisle Vanem
Barry Scott wrote: A copy of this is also in 'c:\Windows\py.ini'. So when I do a: py -3 -c "import sys; print(sys.version)" I would assume a "3.6..." would be printed. But no, py.exe chooses to run my newest Python 3.8: 3.8.9 (default, Apr 13 2021, 15:54:59) [GCC 10.2.0 64 bit (AMD64)]

"py.ini" question

2021-04-24 Thread Gisle Vanem
I have a question about the Python launcher; c:\Windows\py.exe and the py.ini file. I have both Python 3.6 (32-bit) and Python 3.8 (64-bit) installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini' with this only: [defaults] python=3.6 A copy of this is also in 'c:\Windows\py.ini'. So

Re: Current thinking on required options

2021-04-19 Thread Gisle Vanem
Loris Bennett wrote: usage: grocli [-h] [-o {check,add,delete}] [-u USERS [USERS ...]] [-g GROUP] Command line grouper tool optional arguments: -h, --helpshow this help message and exit -o {check,add,delete}, --operation {check,add,delete}

Re: port to PDOS (especially mainframe)

2021-03-23 Thread Gisle Vanem
Edwards wrote: I don't wish to run configure, I want to hand-construct the makefile. PDOS is a very simple system, so I only want to produce a single executable, no DLLs etc. I don't need extensions to work or anything, all I need to be able to do is run asma. Why not try to port MicroPython

Re: Python Error

2020-11-23 Thread Gisle Vanem
Barry Scott wrote: If you have python from python.org installed you should be able to list all the version you have installed with the command: py -0 When was that '-0' feature added? I have Python 3.6 from Python.org and here a 'py.exe -0' gives: Requested Python version (0) not

[issue42078] _tracemalloc.c and Clang-cl

2020-10-19 Thread Gisle Vanem
New submission from Gisle Vanem : Related to: https://bugs.python.org/issue33351 where I commented above the following. When using `clang-cl` to build, I get the following error: ``` Modules/_tracemalloc.c(55,9): error: declaration of anonymous struct must be a definition typedef struct

Re: The speed of glob()

2020-07-29 Thread Gisle Vanem
Chris Angelico wrote: BTW, I just noticed something. The path you're using for testing purposes is "e:/net". Is that network-attached or local? If it's a remote mount of some sort, then that will make a HUGE difference No. Did the word 'net' make you think that :-) It's a local FAT32

Re: The speed of glob()

2020-07-29 Thread Gisle Vanem
Chris Angelico wrote: Has anybody noticed the speed of 'glob()' has decreased somewhere between v3.6 and v3.10. I got these results: Python 3.6.5: 1st run: 0.14694 2nd run: 0.09506 <- *always* the fastest Python 3.7.7:<- from Nuget 1st run: 0.12440 2nd

The speed of glob()

2020-07-29 Thread Gisle Vanem
Has anybody noticed the speed of 'glob()' has decreased somewhere between v3.6 and v3.10. With this little test: import os, sys, timeit, glob # change to suite globPath = u'e:/net/*/*/*/*' def _glob(): glob.glob (globPath) # I used this

Re: How to create an Excel app that runs Python?

2020-03-25 Thread Gisle Vanem
Grant Edwards wrote: On 2020-03-24, oliver wrote: Use the win32com library to interact with Excel via COM. Huh? I thought that the users have no way of running a local Python app. Maybe creating a self-contained .exe using PyInstaller? For me, this: pyinstaller.exe --noconfirm

[issue33351] Support compiling with clang-cl on Windows

2020-01-15 Thread Gisle Vanem
Gisle Vanem added the comment: I will add to this issue my *only* compile problem I had using clang-cl ver 9. It has an issue with parsing the `frame_t` structure in Modules/_tracemalloc.c: Modules/_tracemalloc.c(64,11): error: declaration of anonymous struct must be a definition typedef

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

2019-10-11 Thread Gisle Vanem
Eryk Sun wrote: The simplest way to create a shell link is via the Windows GUI shell, Explorer. To inherit the working directory of the parent process, leave the link's "start in" field empty. Also, add ".LNK" to the system PATHEXT environment variable to allow finding link files without having

Re: Announcing colour-text and colour-print

2019-10-01 Thread Gisle Vanem
Barry Scott wrote: Here is an example: from colour_text import ColourText ct = ColourText() ct.initTerminal() print( ct( "The next section is in green: <>green example<>." ) ) Looking at the sources, it seems 'win32' should be supported. But no; with the above example: c:\>py -3

Re: PIP question

2019-09-27 Thread Gisle Vanem
dieter wrote: directory with some possible leftovers. It there a connection between this mysterious '-ip' package and this directory? This is possible. A so called "distribution" can install packages of a different name (for example, the distribution "Zope" installs (among others) a package

PIP question

2019-09-26 Thread Gisle Vanem
Hello list. This little program should print the location of all my installed Python packages: -- 8< -- 8< --- import pip try: packages = pip.get_installed_distributions (local_only=False, skip=()) except AttributeError: import pkg_resources # Python3 packages =

Passing back the ERRORLEVEL

2018-12-28 Thread Gisle Vanem
I have trouble understanding why a 'sys.exit(2)' is *not* passed back to the CMD shell in this little example: - c:\py_cmd_test.cmd -- @%WinDir%\py.exe -2 -x %~dp0py_cmd_test.cmd & exit /b %ERRORLEVEL% # The '-x' is for Python to skip the 1st line of this file. import sys print ("Hello,

Re: Argh!! Can't wrap my head around this Python stuff!

2017-11-26 Thread nospam . nospam . Gisle Vanem
Greg Tibbet wrote: > ellipse() uses the method self.draw.draw_ellipse() Okay, fine... > but WHERE is draw_ellipse defined?? What magic is happening there? > I've searched the entire PIL directory tree, and the ONLY two places > draw_ellipse is mentioned are right there in the ellipse()

Re: Argh!! Can't wrap my head around this Python stuff!

2017-11-26 Thread nospam . Gisle Vanem
Greg Tibbet wrote: > ellipse() uses the method self.draw.draw_ellipse() Okay, fine... > but WHERE is draw_ellipse defined?? What magic is happening there? > I've searched the entire PIL directory tree, and the ONLY two places > draw_ellipse is mentioned are right there in the ellipse()

Re: Argh!! Can't wrap my head around this Python stuff!

2017-11-26 Thread Gisle Vanem
Greg Tibbet wrote: ellipse() uses the method self.draw.draw_ellipse() Okay, fine... but WHERE is draw_ellipse defined?? What magic is happening there? I've searched the entire PIL directory tree, and the ONLY two places draw_ellipse is mentioned are right there in the ellipse() function...

Re: Easiest way to access C module in Python

2017-11-07 Thread Gisle Vanem
bartc wrote:  From inside python 2.7:    Python 2.7.13rc1 (v2.7.13rc1:4d6fd49eeb14, Dec  3 2016, 21:49:42) [MSC v.1500 32 bit (Intel)] on win32    Type "help", "copyright", "credits" or "license" for more information.    >>> import life    >>> dir(life)    ['__builtins__', '__doc__',

Re: Easiest way to access C module in Python

2017-11-07 Thread Gisle Vanem
Lele Gaifax wrote: On my PC, I get the following, using the "-v" option to verbosely see the imported modules: $ $ python -v # installing zipimport hook import zipimport # builtin # installed zipimport hook ... import life dlopen("./life.so", 2); import life # dynamically loaded from life.so

Re: Easiest way to access C module in Python

2017-11-07 Thread Gisle Vanem
Lele Gaifax wrote: $ python setup.py build_ext --inplace Compiling life.pyx because it changed. [1/1] Cythonizing life.pyx running build_ext building 'life' extension creating build creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall

Re: Windows: subprocess won't run different Python interpreter

2016-11-11 Thread Gisle Vanem via Python-list
Thorsten Kampe wrote: > My goal is to verify that other shells/interpreters on Windows work > the same way as Python when running an application or creating a sub- > process. Cmd does not. What's else there? I have Bash here but that's > a Cygwin executable. And Cygwin Python does not work like

Re: The next major Python version will be Python 8

2016-04-01 Thread Gisle Vanem via Python-list
Michael Selik wrote: > It suddenly occurred to me that if Microsoft announced it's > Ubuntu-in-Windows feature today, no one would believe it. My feeling too, but this was announced 30 March. In the video in this link:

Re: Testing whether the VPN is running?

2016-02-23 Thread Gisle Vanem
Cameron Simpson: > You might also want to check that the interface is up. > > My personal hack (not for a VPN, but for "being online", which turns my ssh > tunnels on and off) is to look in the output > of "netstat -rn" for a default route. This may imply that an alternative test > for you is

Re: extending PATH on Windows?

2016-02-19 Thread Gisle Vanem
Dennis Lee Bieber wrote: >>> How can one search for files with DOS? >> >> dir /s /b \*add2path.* >> >> ChrisA > > Or move to PowerShell... > > Windows PowerShell > Copyright (C) 2009 Microsoft Corporation. All rights reserved. > > PS C:\Users\Wulfraed\Documents> Get-ChildItem -Path c:\

Re: python.exe is not a valid win32 executable

2015-10-29 Thread Gisle Vanem
Mark Lawrence wrote: CPython's Windows support now follows this lifecycle. A new feature release X.Y.0 will support all Windows releases whose extended support phase is not yet expired. Subsequent bug fix releases will support the same Windows releases as the original feature release (even if

Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem
"Peter Brittain" wrote: I have recently been working on a terminal/console animation package (https://github.com/peterbrittain/asciimatics). I tried installing your package with "pip.exe -v install asciimatics". Some problem with pypiwin32 it seems: Installing

Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem
"Chris Angelico" wrote: Ah, that might well be it. Does it work if you run: python -S -m pip install --upgrade win32api Hm. c:\>python2 -S -m pip install --upgrade win32api Collecting win32api Could not find any downloads that satisfy the requirement win32api No

Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem
"Chris Angelico" <ros...@gmail.com> wrote: On Thu, Oct 22, 2015 at 10:22 PM, Gisle Vanem <gva...@yahoo.no> wrote: IOError: [Errno 13] Permission denied: 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd' - BTW, this is on Python 2.7.9 on Win-XP

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread Gisle Vanem
eryksun wrote: Here's a slightly simpler way to open the folder: py -3.5 -c "import os, sys; os.startfile(sys.prefix)" And what to do if the Pylauncher itself seems confused or the Registry settings for PythonCore is messed up? The WOW64 mess MS has have seems to have caused some

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2015-10-15 Thread Gisle Vanem
eryksun wrote: The version of py.exe distributed with Python 3 is a 32-bit application, so when the debug output says it's looking in the "native" registry, it's referring to the WOW64 redirected registry path, i.e. "HKLM\Software\Wow6432Node\Python". If py.exe can't find your installation of

Re: Issue: cannot successfully install Python 3 on Windows 7

2015-09-29 Thread Gisle Vanem
Gilad Mayani wrote: I always get this message: the program can't start because api-ms-win-crt-runtime-I1-1-0.dll is missing from your computer. Is that really an 'I' in there? The .dll should really be named: %SystemRoot%\system32\api-ms-win-crt-runtime-l1-1-0.dll with an lower-case

Py_InitializeEx() in CygWin64's Python2.7

2015-07-01 Thread Gisle Vanem
I've written a C-program that embeds Python 2.7. It has worked fine for several years using MingW or MSVC. Now I'd like to support the python2.7.exe that comes with CygWin64. But it seems to fail inside 'Py_InitializeEx(0)' where it just prints: ImportError: No module named site What? Does

Python 3.5 crashes on wrong %PYTHONHOME

2015-05-27 Thread Gisle Vanem
I just installed the 32-bit Python 3.5b4 via the Web-installer. First, I was a bit annoyed by the fact it installed under 'f:\ProgramFiler-x86\Python35' instead of 'f:\ProgramFiler\Python35' as I customided for. But I guess this is a WOW64 thing. I'm on Win-8.1 (64-bit). But then I noticed

Re: Python 3.5 crashes on wrong %PYTHONHOME

2015-05-27 Thread Gisle Vanem
Zachary Ware wrote: Is there any particular reason you're setting PYTHONHOME in the first place? I have several GNU Makefiles that picks up this variable (to find Python.h, python*.lib etc.). But using Python 27 and 35 w/o having a %PYTHONHOME set, seems to work fine. I have to revise those

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Gisle Vanem
Chris Angelico wrote: There's a specific search order. Back in the days of DOS, it was simply com, then exe, then bat, but on modern Windowses, I think it's governed by an environment variable. You probably mean '%PATHEXT'. Mine is:

Re: l = range(int(1E9))

2015-04-30 Thread Gisle Vanem
Cecil Westerhof wrote: If I execute: l = range(int(1E9) The python process gobbles up all the memory and is killed. The problem is that after this my swap is completely used, because other processes have swapped to it. This make those programs more slowly. Is there a way to circumvent

Re: Python27.dll could not be found

2015-03-02 Thread Gisle Vanem
Dave Angel wrote: When I ran Windows, I had written a simple utility that searched the PATH for a specified file. I called it which.bat to match the Linux equivalent. I've written a similar tool; envtool --path --python python27.dll Matches in %PATH: 15 May 2013 - 21:43:38:

Re: Python path on windows

2015-02-21 Thread Gisle Vanem
Dave Angel wrote: Finally, when py.exe starts, it reads that first (shebang) line, and decides which python interpreter to actually use. py.exe? Do you mean python.exe? Is there a way to make python.exe ignore all Shebang lines in all scripts? I had many generated .py-files with:

Odd version scheme

2015-02-12 Thread Gisle Vanem
I tried using Interactive Python with a PyQt4 console: IPython.exe qtconsole But got a ImportError: IPython requires PyQT4 = 4.7, found 4.10.4 Looking at Ipython's check (in site-packages\IPython\external\qt.py): if QtCore.PYQT_VERSION_STR '4.7': raise ImportError(IPython requires

Re: Odd version scheme

2015-02-12 Thread Gisle Vanem
Tim Chase wrote: So the test should actually be something like if LooseVersion(QtCore.PYQT_VERSION_STR) LooseVersion(4.10): balk() That's exactly what they do now in IPython/utils/version.py with the comment: Utilities for version comparison It is a bit ridiculous that we need

Re: Non-unique dirs in sys.path

2015-01-09 Thread Gisle Vanem
Ian Kelly wrote: I checked my own Python 2.7 installation and discovered that I have the same problem, although without the different casing. Perusing the .pth files in site-packages turns up setuptools.pth, which just contains the site-packages path. Removing that file solves the issue for me.

Non-unique dirs in sys.path

2015-01-09 Thread Gisle Vanem
(sys.path)] | sort --ignore-case which produces: f:\Documents and Settings\Gisle Vanem\Programdata\Python\Python27\site-packages f:\windows\system32\python27.zip !! doesn't exist, but okay. G:\Programfiler\Python27 g:\Programfiler\Python27\DLLs g:\Programfiler\Python27\lib g

Re: Command Line Inputs from Windows

2015-01-03 Thread Gisle Vanem
Ken Stewart wrote: Here is a sample key: S1-5-21-1560217580-722697556-320042093-1000-Classes py_auto_file shell open command The corrected data for the key looks like this: C:\Python34\python.exe %1 %* Yikes! You use the awful cmd.exe as the shell

Re: set environmental variable from python

2014-10-31 Thread Gisle Vanem
Artur Bercik vbubbl...@gmail.com wrote: I have to set several variables so it would be easier if I could set them from Python. You can write a Python-script that generates a .bat file (in your %TEMP-dir?). And run this .bat file when Python ends. Put it all in an alias or another .bat file.

Re: What can Nuitka do?

2014-06-28 Thread Gisle Vanem
Chris Angelico ros...@gmail.com wrote: The only other time I've been waiting for X display was when I was mobile, on a 3G connection, and using X11 forwarding on an SSH link back to my home LAN. Doing X11 calls over a network could really be a nuisance for others. And an archaic design

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Gisle Vanem
Grant Edwards wrote: Not *any* computer? Not in *any* way? The Python built-in float type works with the set of real numbers, in a way. The only people who think that are people who don't actualy _use_ floating point types on computers. FPU parsing the IEEE spec, or?. I didn't quite parse

Re: Newcomer Help

2014-02-10 Thread Gisle Vanem
Walter Hughey wkhug...@gmail.com wrote: Thank you for your reply. One quick question, when I reply should it be replay to all or to the person who sent the emial? When replying, the most important thing to remember is... order. A: Because it messes up the order in which people normally read

Vedr: What does means in python?

2014-02-08 Thread Gisle Vanem
  Gisle V. Computers are useless. They can only give answers --Pablo Picasso Chris Angelico ros...@gmail.com wrote: For SQL? Ignore the extra spaces, it's a free-form language. The only reason to consider dedent() would be if you're worried about how your log files will look. The actual

Re: Odd msg received from list

2013-11-14 Thread Gisle Vanem
Chris Angelico ros...@gmail.com wrote: I agree in general, but I happen to be pretty familiar with Mailman alerts, and this one was genuine. Also, it pointed to what does appear to be the right address (mail.python.org). There's definitely something going around that's causing problems for

Re: how to find out utf or not

2013-11-05 Thread Gisle Vanem
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If myVar is a Unicode string, you don't need to care about the encoding (UTF-8 or otherwise) until you're ready to write it to a file. Then I strongly recommend you always use UTF-8, unless you have to interoperate with some old,

Re: Running code from source that includes extension modules

2013-10-02 Thread Gisle Vanem
Michael Schwarz michi.schw...@gmail.com wrote: So how do I run my code so it will find the built extension module? Do I pass the output directory on the command line manually or is there some other solution? I would like to still be able to run the code from the source directory as I'm using

Re: DNS query against a specific server.

2013-09-30 Thread Gisle Vanem
Chris Angelico ros...@gmail.com wrote: There are a few Python DNS modules. It means adding another dependency, but perhaps not as large as twisted. And of course, you could always manually send UDP packets and listen for responses, but that seems a little unnecessary :) Then there is pycares;

Calling Py_Main() and parsing the output from C

2013-08-10 Thread Gisle Vanem
Hello Python C-experts. I'm trying to embed python27.dll in a C-program written in MingW-gcc 4.7.2. I've successfully done these initial steps: typedef int (*Py_Main_t) (int argc, char **argv); handle = LoadLibrary (python27.dll); py_main = (Py_Main_t) GetProcAddress (handle, Py_Main);

Modules list-tool

2013-05-21 Thread Gisle Vanem
Are anyone aware of a tool that can show me at run-time which modules (pyd/dll) are loaded into a Python program at a specific time (or over time)? To clarify, e.g. when running a sample from PyQt4 (examples\tutorials\addressbook\part1.pyw) and using Process Explorer [1], I can launch WinDbg

Re: Python newbie trying to embed in C++

2013-02-28 Thread Gisle Vanem
Marwan Badawi marwan.bad...@inria.fr wrote: I just noticed that my reply went to the message sender and not to the newsgroup, so I'm posting again: thanks, I'll look into that. Yes, I often do that too; i.e. I'm subscribed to python-list@python.org and get all messages from comp.lang.python

FYI: AI-programmer

2013-02-22 Thread Gisle Vanem
Here is something interesting that you pythonistas might be interested in: http://www.primaryobjects.com/CMS/Article149.aspx This article describes an experiment to produce an AI program, capable of developing its own programs, using a genetic algorithm implementation with self-modifying

Re: FYI: AI-programmer

2013-02-22 Thread Gisle Vanem
Chris Angelico ros...@gmail.com wrote: That's not artificial intelligence, though. It's artificial program generation based on a known target output. The Fitness calculation is based on a specific target string. This is fine for devising a program that will produce the entire works of

Re: pylint or similar to test version-specific language constructs?

2013-01-09 Thread Gisle Vanem
jkn jkn...@nicorp.f9.co.uk wrote: I have to write python code which must run on an old version of python (v2.4) as well as a newer (v2.7). I am using pylint and would like to check if is possible to check with pylint the use of operators etc. which are not present in 2.4; the ternary

Re: Calculate Big Number

2013-01-08 Thread Gisle Vanem
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: py from timeit import Timer py t1 = Timer((a**b)*(c**d), setup=a,b,c,d = 10, 25, 2, 50) py min(t1.repeat(repeat=5, number=10)) 0.5256571769714355 So that's about 5 microseconds on my (slow) computer. That's pretty fast. So is

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-03 Thread Gisle Vanem
Wayne Werner wa...@waynewerner.com wrote: Yep. That's how I feel. I had used ViEmu in Visual Studio for coding in .NET at work - but I found that the buffers macros were more powerful. So now I do most of my programming in Vim, and only head to VS if I need autocomplete or some of it's

Re: Question about nested loop

2012-12-31 Thread Gisle Vanem
Isaac Won winef...@gmail.com wrote: while c 10: c = c + 1 for columns in ( raw.strip().split() for raw in f ): b.append(columns[c]) y = np.array(b, float) print c, y I thought that can get the arrays of the columns[5] to [10], but I only could

Re: Running a curl command within py script

2012-11-14 Thread Gisle Vanem
Smaran Harihar smaran.hari...@gmail.com wrote: i found pycurl to execute python curl command but not sure how I can execute the curl command using the pycurl. curl -u admin:geoserver -v -XPUT -H 'Content-type: text/plain' -d 'file:/var/www/geo/shapefile/csvQshp/Quercus_iltisii.shp'

Re: Python on Windows

2012-10-20 Thread Gisle Vanem
Tim Golden m...@timgolden.me.uk wrote: In general, you'll want to be using a mechanism such as pip: http://pypi.python.org/pypi/pip which will look things up on PyPI so you can just do pip install newmodule. And if you have a pip.bat from some Perl installation sitting before python's

for-loop on cmd-line

2012-10-11 Thread Gisle Vanem
Hello list. I'm a newbie when it comes to Python. I'm trying to turn this: def print_sys_path(): i = 0 for p in sys.path: print ('sys.path[%2d]: %s' % (i, p)) i += 1 into a one-line python command (in a .bat file): python -c import sys,os; i=0; for p in sys.path:

Re: for-loop on cmd-line

2012-10-11 Thread Gisle Vanem
Dave Angel d...@davea.name wrote: it has nothing to do with being on a command line. You're using semicolon to combine several statements, and there are restrictions on what can be combined that way. One restriction is the looping constructs, for, if, while. Ok, I suspected something like

Re: for-loop on cmd-line

2012-10-11 Thread Gisle Vanem
wxjmfa...@gmail.com wrote in comp.lang.python (my ISP no longer updates this group. Last message is from 8. April. Does the postings to the python mailing-list automatically get reposted to comp.lang.python?) C:\Windows\system32\python32.zip c:\python32\DLLs I see a similar result:

Re: for-loop on cmd-line

2012-10-11 Thread Gisle Vanem
Dave Angel d...@davea.name wrote: Why would you write some C-program just to save having two separate files, one batch and one for the script? For that matter, several answers have given you approaches that didn't involve list comprehensions, including merging the two in a single file, using

FOX Toolkit

2011-07-01 Thread Gisle Vanem
In http://docs.python.org/faq/gui.html I came across FOX Toolkit and the binding FXPy. The latter, it seems is no longer officially supported (hasn't for the last 7-8 years). So my question. Has anybody to your knowledge tweaked FOX and FXPy to work with Python 2.7? --gv --