Re: [Tutor] running a .py file from the comand line

2018-04-02 Thread eryk sun
On Mon, Apr 2, 2018 at 8:53 AM, Alan Gauld via Tutor wrote: > > Try > > python c:\Users\Rex\"ascii keys.py" > > Note the quotes to cater for the space. > >> python: can't open file 'Ascii': [errno2] no such file or directory > > The space confuses windows CMD, so it thinks you have > two files c

Re: [Tutor] Python C extension - which method?

2018-05-06 Thread eryk sun
On Sun, May 6, 2018 at 12:49 AM, Brad M wrote: > If I may ask, what's the difference between these two? > > 1) > import ctypes > hello = ctypes.WinDLL('hello', use_last_error=True) > > 2) > from ctypes import cdll > hello = cdll.LoadLibrary('hello.dll') Use ctypes.CDLL and ctypes.WinDLL instead o

Re: [Tutor] passing values and C pointers

2018-05-06 Thread eryk sun
On Sun, May 6, 2018 at 2:17 AM, Brad M wrote: > > Say I have an array of values, say addresses or int produced by a c module/ > c function that's in a DLL , how do I pass that array back to > the python code? C arrays are passed and returned automatically as pointers to the first element. The arr

Re: [Tutor] Python C extension - which method?

2018-05-07 Thread eryk sun
On Mon, May 7, 2018 at 9:57 AM, Michael C wrote: > Sorry I don't understand your suggestion. > > Use "ctypes.CDLL" and "ctypes.WinDLL" > > this works, > mydll = cdll.LoadLibrary('test.dll') > print(mydll.sum(3,2)) > > and this doens't > mydll = cdll('test.dll') > print(mydll.sum(3,2)) > > What's t

Re: [Tutor] calling printf() in a C language DLL using ctypes.CDLL

2018-05-08 Thread eryk sun
On Tue, May 8, 2018 at 9:39 AM, Brad M wrote: > > I compile this by typing this in the command line: > cl /LD /I C:\python\include helloworld.c C:\python\libs\python36.lib You're not using Python's C API, so you only need `cl /LD helloworld.c`. > However, this doesn't print anything on the pytho

Re: [Tutor] calling printf() in a C language DLL using ctypes.CDLL

2018-05-08 Thread eryk sun
On Wed, May 9, 2018 at 1:30 AM, Brad M wrote: > > If you want to know where your program went when something went wrong or > when it triggers a if condition, how do you do it? Look into use the logging module [1] and debuggers [2], either dedicated like Winpdb or in an IDE such as PyCharm. [1]:

Re: [Tutor] what does the forward slash mean in this function signature?

2018-10-15 Thread eryk sun
On Mon, Oct 15, 2018 at 6:00 AM Albert-Jan Roskam wrote: > > In Python 3.6 (Windows) I often see a forward slash in a function signature, > see below. > What does it mean? I vaguely remember reading something about new > possbilities in > python 3, something like "def foo(x, *, y)". Perhaps it's

Re: [Tutor] What is the best way for a program suite to know where it is installed?

2018-10-22 Thread eryk sun
On 10/22/18, boB Stepp wrote: > > Importing the various program modules/module contents is > no issue. Where I believe I need to know the paths to things are to > get to data folders, config files, and occasionally utility programs > that I have written that are on my hard drive, but not copied t

Re: [Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

2019-02-27 Thread eryk sun
On 2/27/19, Chip Wachob wrote: > > I've been spending the morning looking at different solutions. Many of > them seem to involve either including yet aother module, or, worse (IMHO) a > C library that will 'emulate' the ANSI escape sequences, API calls, etc. To support virtual-terminal sequences

Re: [Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

2019-02-27 Thread eryk sun
On 2/27/19, Alan Gauld via Tutor wrote: > On 27/02/2019 18:28, Chip Wachob wrote: >> Windows 7 vintage machine this morning. > > Caveat: I have no direct experience on Windows 7 - I jumped > from XP to Windows 8... Also I haven't used ANSIO codes in > Windows since the heady days of Windows 98! Bu

Re: [Tutor] Exception not working as expected?

2019-02-28 Thread eryk sun
On 2/28/19, Chip Wachob wrote: > > Python 2.7 & Windows and also Linux are the platforms being used. Running > the code from the command line / terminal as python except.py. Note that > it does work properly in Linux. So I'm guessing I need to test for a > different exception along with the K

Re: [Tutor] What is this code doing? What is it?

2019-05-12 Thread eryk sun
On 5/12/19, Alan Gauld via Tutor wrote: > > They are both very powerful ways of constructing output strings with > data inserted. {} and format() has a few extra tricks once you get > into advanced uses, but % style does most of the same things (and > has the advantage of being used in other langu

Re: [Tutor] Case Insensitive Globing

2019-05-19 Thread eryk sun
On 5/18/19, Steven D'Aprano wrote: > > That means that, like Windows file systems FAT and NTFS, file names are > case-insensitive: files "Foo", "foo" and "FOO" are all considered the > same. But unlike Windows, the file system preserves the case of the file > as you created it, so if you created i

Re: [Tutor] How arguments to the super() function works?

2019-05-19 Thread eryk sun
On 5/19/19, Arup Rakshit wrote: > > class Dad: > def can_i_take_your_car(self): > print("No...") > > class Mom(Dad): > def can_i_take_your_car(self): > print("Asking your dad...") > > class Victor(Mom, Dad): > def can_i_take_your_car(self): > print("Asking mom..

Re: [Tutor] Case Insensitive Globing

2019-05-19 Thread eryk sun
On 5/19/19, Alan Gauld via Tutor wrote: > > Hmm, odd. My NTFS filesystems on Windows all appear to be case > sensitive. For example I have a photo editor that saves its files > with a jpg extension but the files from my camera all end in JPG. > So I always end up with two copies - the original fil

Re: [Tutor] Installing Python v3 on a laptop Windows 10

2019-06-15 Thread eryk sun
On 6/15/19, Alan Gauld via Tutor wrote: > On 15/06/2019 22:23, Ken Green wrote: > >> I understood there is a preferable method >> of installing Python into Windows. I pray >> tell on how about to do it, gentlemen. > > It depends a bit on which python distribution you use, > there are several. > >

<    1   2