Calling of GetVolumeInformation returns empty serial number

2017-11-07 Thread Durumdara
Hi! Windows 10, Python 3.6. I want to get the serial number of the drives (without external modules like Win32 or WMI). It is needed for identification of removable devices (like USB external drives). Somewhere I saw this code: def GetVolumeID(Drive): import ctypes kernel32 = ctypes.win

Re: Calling of GetVolumeInformation returns empty serial number

2017-11-07 Thread Thomas Jollans
On 2017-11-07 08:58, Durumdara wrote: > Hi! > > Windows 10, Python 3.6. > > I want to get the serial number of the drives (without external modules > like Win32 or WMI). > It is needed for identification of removable devices (like USB external > drives). > > Somewhere I saw this code: > > def G

PyDev 6.1.0 Released

2017-11-07 Thread Fabio Zadrozny
PyDev 6.1.0 Release Highlights - *Important* PyDev now requires Java 8 and Eclipse 4.6 (Neon) onwards. - PyDev 5.2.0 is the last release supporting Eclipse 4.5 (Mars). - *Code Formatter* - The PyDev code formatter can now add/remove blank lines to comply with pep-8.

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 02:23, Chris Angelico wrote: On Tue, Nov 7, 2017 at 12:52 PM, bartc wrote: Cython seems very confusing to me. Otherwise what /I/ would look for is ways to call C functions inside shared libraries (.dll and .so). That requires that the modules under test be wrapped as a sh

Re: Easiest way to access C module in Python

2017-11-07 Thread Chris Angelico
On Tue, Nov 7, 2017 at 10:06 PM, bartc wrote: > On 07/11/2017 02:23, Chris Angelico wrote: >> >> On Tue, Nov 7, 2017 at 12:52 PM, bartc wrote: > > >>> Cython seems very confusing to me. >> >> > >> >>> Otherwise what /I/ would look for is ways to call C functions inside >>> shared >>> libraries (.

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 11:16, Chris Angelico wrote: On Tue, Nov 7, 2017 at 10:06 PM, bartc wrote: My experience is different. Thanks for the FUD. I love it when someone, on the basis of one failed experiment, trash-talks an excellent piece of software that would solve the OP's problem. OK, I gave

Re: Easiest way to access C module in Python

2017-11-07 Thread Paul Moore
On 7 November 2017 at 11:16, Chris Angelico wrote: > Thanks for the FUD. I love it when someone, on the basis of one failed > experiment, trash-talks an excellent piece of software that would > solve the OP's problem. It *is* true that the learning curve for Cython is steeper than that of ctypes.

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 11:35, Paul Moore wrote: On 7 November 2017 at 11:16, Chris Angelico wrote: Thanks for the FUD. I love it when someone, on the basis of one failed experiment, trash-talks an excellent piece of software that would solve the OP's problem. It *is* true that the learning curve for C

Re: Calling of GetVolumeInformation returns empty serial number

2017-11-07 Thread eryk sun
On Tue, Nov 7, 2017 at 7:58 AM, Durumdara wrote: > > I want to get the serial number of the drives (without external modules > like Win32 or WMI). The volume serial number is more easily available as os.stat(drive).st_dev, which comes from calling GetFileInformationByHandle. Note that despite usi

Re: Easiest way to access C module in Python

2017-11-07 Thread Lele Gaifax
bartc writes: > But just staying with the "function with no arguments" for the minute (the > equivalent of Hello World for this exercise), how would it be done in > Cython? Would a working example be simple enough to show in a usenet post? fred.c:: int fred(void) { return 42; } life

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 12:14, Lele Gaifax wrote: bartc writes: But just staying with the "function with no arguments" for the minute (the equivalent of Hello World for this exercise), how would it be done in Cython? Would a working example be simple enough to show in a usenet post? fred.c:: int

Re: I am trying to delete duplicates but the job just finishes with an exit code 0

2017-11-07 Thread Peter Otten
tysondog...@gmail.com wrote: > I am trying to delete duplicates but the job just finishes with an exit > code 0 and does not delete any duplicates. > > The duplicates for the data always exist in Column F and I am desiring to > delete the entire row B-I > > Any ideas? > > > import openpyxl > w

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 13:11, bartc wrote: $ python setup.py build_ext --inplace OK, thanks. Although when I get to this bit, my system still says: 17.297 Traceback (most recent call last):   File "setup.py", line 1, in     from distutils.core import setup   Update: if I copy the

Re: Easiest way to access C module in Python

2017-11-07 Thread Lele Gaifax
bartc writes: > OK, compiling fred.c. Is there a dependency on gcc too? This looks more like > makefile hell. That's pretty standard distutils functionality. I'm pretty sure that on M$Windows it would invoke its C compiler, not gcc. I wrote "fred.c" to get closer to the case you mentioned, but

Re: Easiest way to access C module in Python

2017-11-07 Thread Thomas Jollans
On 2017-11-07 12:53, bartc wrote: > Having > said that, I located pip.exe, trying typing 'pip install cffi' and it > seemed to be doing something but then failed with a bunch of errors.) So you're missing out on all of PyPI? That's tragic. You should really try to fix that. I'm sure people on this

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 13:30, Thomas Jollans wrote: On 2017-11-07 12:53, bartc wrote: Having said that, I located pip.exe, trying typing 'pip install cffi' and it seemed to be doing something but then failed with a bunch of errors.) So you're missing out on all of PyPI? That's tragic. You should really

Re: Easiest way to access C module in Python

2017-11-07 Thread Tim Golden
On 07/11/2017 14:20, bartc wrote: On 07/11/2017 13:30, Thomas Jollans wrote: On 2017-11-07 12:53, bartc wrote: Having said that, I located pip.exe, trying typing 'pip install cffi' and it seemed to be doing something but then failed with a bunch of errors.) So you're missing out on all of PyP

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 14:33, Tim Golden wrote: On 07/11/2017 14:20, bartc wrote: You've lost me. I had to look up pyPI and it's something to do with a Package Index. But I don't know how that relates to installing Cython. Can I just step in now with my Moderator hat on and ask: please avoid a lengt

What happens to module's variables after a "from module import" ?

2017-11-07 Thread ast
Hello Here is my module tmp.py: a=0 def test(): global a print(a) a+=1 If I import function "test" from module "tmp" with: from tmp import test it works test() 0 test() 1 But where variable "a" is located ? I can't find it anywhere Regards -- https://mail.python.org/

Re: What happens to module's variables after a "from module import" ?

2017-11-07 Thread Paul Moore
On 7 November 2017 at 15:39, ast wrote: > Hello > > Here is my module tmp.py: > > a=0 > > def test(): >global a >print(a) >a+=1 > > If I import function "test" from module "tmp" with: > from tmp import test > > > it works > test() > > 0 test() > > 1 > > But where va

Re: Incomplete description using sqlite3

2017-11-07 Thread Sibylle Koczian
Am 06.11.2017 um 23:40 schrieb Skip Montanaro: I'm using sqlite3 (2.6.0, SQLite version 3.13.0, Python 2.7.13) and was hoping to introspect the types of a table using the cursor's description attribute. PEP 249 states: "The first two items (name and type_code) are mandatory..." I tried this query

Re: What happens to module's variables after a "from module import" ?

2017-11-07 Thread Peter Otten
ast wrote: > Hello > > Here is my module tmp.py: > > a=0 > > def test(): > global a > print(a) > a+=1 > > If I import function "test" from module "tmp" with: > from tmp import test > > it works > test() > 0 test() > 1 > > But where variable "a" is located ? I can

Re: What happens to module's variables after a "from module import" ?

2017-11-07 Thread ast
"Paul Moore" a écrit dans le message de news:mailman.53.1510069830.2819.python-l...@python.org... On 7 November 2017 at 15:39, ast wrote: It's in the "tmp" module, where you defined it. But because you didn't ask for a reference to it in your import statement, it's not accessible to you[1

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Fri, Nov 3, 2017 at 11:55 PM, Ben Finney wrote: > Ian Kelly writes: > >> Please stop defending the use of incivility on this list. > > Please stop conflating people, who deserve civility, with ideas. We must > not allow the civility deserved by people, to prevent us from > criticising any idea

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: > On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens > wrote: >> On 2017-11-04, Ben Finney wrote: >>> To respond to the criticism of an idea – criticism containing no mention >>> of the person – as though it “clearly refers to the [person]”, is of

Re: Easiest way to access C module in Python

2017-11-07 Thread Rob Gaddi
On 11/06/2017 05:59 PM, Grant Edwards wrote: On 2017-11-06, John Pote wrote: I have successfully used Python to perform unit and integration tests in the past and I'd like to do the same for some C modules I'm working with at work. There seem to be a number of ways of doing this but being busy

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

Re: Easiest way to access C module in Python

2017-11-07 Thread Lele Gaifax
Gisle Vanem writes: > python.exe -c "import life; print(life.life())" > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'module' object has no attribute 'life' > > Can you give a hint? I tried with Python 2, and the same recipe works for me, on GNU/Linux: $ python

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 4:28 AM, Ian Kelly wrote: > On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens >> wrote: >>> On 2017-11-04, Ben Finney wrote: To respond to the criticism of an idea – criticism containing no mention of the pers

Re: Ideas about how software should behave

2017-11-07 Thread Grant Edwards
On 2017-11-07, Stefan Ram wrote: > Chris Angelico writes: >>sure what your point is. None, False, and True are all keywords, not >>built-ins, so you can't assign to them (any more than you could assign >>to a literal integer). > >|Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bi

Re: Ideas about how software should behave

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 6:44 AM, Stefan Ram wrote: > Chris Angelico writes: >>sure what your point is. None, False, and True are all keywords, not >>built-ins, so you can't assign to them (any more than you could assign >>to a literal integer). > > |Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38)

ANN: Wing Python IDE v. 6.0.8 released

2017-11-07 Thread Wingware
Hi, We've just released Wing 6.0.8, a minor release that improves display of PEP 287 docstrings, fixes stability problems seen on Linux, fixes remote debugging of Django code, further improves remote development, adds some missing vi bindings, and makes about 30 other improvements. For detai

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: Ideas about how software should behave

2017-11-07 Thread Grant Edwards
On 2017-11-07, Chris Angelico wrote: > On Wed, Nov 8, 2017 at 6:44 AM, Stefan Ram wrote: >> Chris Angelico writes: >>>sure what your point is. None, False, and True are all keywords, not >>>built-ins, so you can't assign to them (any more than you could assign >>>to a literal integer). >> >> |Py

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 20:08, Gisle Vanem wrote: 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); impor

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Tue, Nov 7, 2017 at 12:10 PM, Chris Angelico wrote: > On Wed, Nov 8, 2017 at 4:28 AM, Ian Kelly wrote: >> On Sat, Nov 4, 2017 at 6:40 AM, Chris Angelico wrote: >>> Maybe we're not defending the abuse of other contributors. Maybe we're >>> defending a legitimate, if somewhat caustic, response

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__', '__file__'

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 8:16 AM, Ian Kelly wrote: > All of these are things that a linter should probably catch and warn > about. If you had said that the break syntax suggestion was a good > idea but probably better suited as a linter warning than as a > SyntaxError integrated into the parser, the

Re: Ideas about how software should behave

2017-11-07 Thread Ben Finney
Ian Kelly writes: > Nowadays I realize and accept that this is preposterous. You cannot > criticize an idea without also criticizing the people who are attached > to that idea. Maybe so. Does that mean we must not criticise ideas? Later in your message you say no, but everything leading up to it

Re: Ideas about how software should behave

2017-11-07 Thread Ned Batchelder
On 11/7/17 5:48 PM, Ben Finney wrote: Ian Kelly writes: Nowadays I realize and accept that this is preposterous. You cannot criticize an idea without also criticizing the people who are attached to that idea. Maybe so. Does that mean we must not criticise ideas? Later in your message you say

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Steve D'Aprano
On Wed, 8 Nov 2017 04:28 am, Ian Kelly wrote: > Steve's manufactured interactive example ("manufactured" because > who really uses for-else interactively? If I really care that much > about output formatting I'm going to put it in a script). Me. As I have said. I really don't appreciate you imp

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-07 Thread Ian Kelly
On Tue, Nov 7, 2017 at 4:28 PM, Steve D'Aprano wrote: > On Wed, 8 Nov 2017 04:28 am, Ian Kelly wrote: > >> Steve's manufactured interactive example ("manufactured" because >> who really uses for-else interactively? If I really care that much >> about output formatting I'm going to put it in a scr

Re: python3 byte decode

2017-11-07 Thread Ali Rıza KELEŞ
Hi, On 5 November 2017 at 04:06, Cameron Simpson wrote: > On 04Nov2017 01:47, Chris Angelico wrote: >> >> On Fri, Nov 3, 2017 at 8:24 PM, Ali Rıza KELEŞ >> wrote: >>> >>> Yesterday, while working with redis, i encountered a strange case. >>> >>> I want to ask why is the following `True` >>> >>>

Re: python3 byte decode

2017-11-07 Thread Chris Angelico
On Wed, Nov 8, 2017 at 4:36 PM, Ali Rıza KELEŞ wrote: >> To be more clear here, usually when humans say "identical" they mean having >> exactly the same value or attributes. >> Here, Chris means that the two strings are actually the same object rather >> than two equivalent objects. "is" tests the