From rohan.vaidya.etl at gmail.com  Fri Jan 10 02:25:11 2025
From: rohan.vaidya.etl at gmail.com (rohan vaidya)
Date: Fri, 10 Jan 2025 12:55:11 +0530
Subject: [Tutor] Issue with zlib module
Message-ID: <CANDnkvSnmU=K+GrWEG2A+QqCqTG9NLLsNCSepBkrfHcn3b_m=w@mail.gmail.com>

Hi all,

I am trying to create virtual environments to install python 3.9.21 but
facing issue with zlib

Error as - modulenotfounderror no module named zlib

Can anymore please help in resolving this issue ?

Thanks
Rohan vaidya

From mats at wichmann.us  Fri Jan 10 13:44:19 2025
From: mats at wichmann.us (Mats Wichmann)
Date: Fri, 10 Jan 2025 11:44:19 -0700
Subject: [Tutor] Issue with zlib module
In-Reply-To: <CANDnkvSnmU=K+GrWEG2A+QqCqTG9NLLsNCSepBkrfHcn3b_m=w@mail.gmail.com>
References: <CANDnkvSnmU=K+GrWEG2A+QqCqTG9NLLsNCSepBkrfHcn3b_m=w@mail.gmail.com>
Message-ID: <1d969dce-1731-4a0e-a5e7-aac4abe6dd7c@wichmann.us>

On 1/10/25 00:25, rohan vaidya via Tutor wrote:
> Hi all,
> 
> I am trying to create virtual environments to install python 3.9.21 but
> facing issue with zlib
> 
> Error as - modulenotfounderror no module named zlib
> 
> Can anymore please help in resolving this issue ?
zlib is a binary module, not a pure Python one.  It needs a shared 
library that patches the Python version, which should be getting 
installed when you install Python.

Can you say a bit more about what you're doing? What's your platform? 
Are you downloading a prebuilt Python 3.9 or building your own?  On 
Linux at least, building the library (which will end up with a name like 
zlib.cpython-39-x86_64-linux-gnu.so) should work because cpython 
"vendors" it - that is, includes the source code in the cpython source 
bundle, and will use that unless the system zlib (and associated 
development kit) is usable for the build.



From mats at wichmann.us  Fri Jan 10 13:45:40 2025
From: mats at wichmann.us (Mats Wichmann)
Date: Fri, 10 Jan 2025 11:45:40 -0700
Subject: [Tutor] Issue with zlib module
In-Reply-To: <1d969dce-1731-4a0e-a5e7-aac4abe6dd7c@wichmann.us>
References: <CANDnkvSnmU=K+GrWEG2A+QqCqTG9NLLsNCSepBkrfHcn3b_m=w@mail.gmail.com>
 <1d969dce-1731-4a0e-a5e7-aac4abe6dd7c@wichmann.us>
Message-ID: <5c520a61-4b9c-4e60-9f63-4a809144589a@wichmann.us>

On 1/10/25 11:44, Mats Wichmann wrote:
> On 1/10/25 00:25, rohan vaidya via Tutor wrote:
>> Hi all,
>>
>> I am trying to create virtual environments to install python 3.9.21 but
>> facing issue with zlib
>>
>> Error as - modulenotfounderror no module named zlib
>>
>> Can anymore please help in resolving this issue ?
> zlib is a binary module, not a pure Python one.? It needs a shared 
> library that patches the Python version, 

eh sorry for typo, should have been "matches the Python version".


From mk1853387 at gmail.com  Wed Jan 15 12:40:43 2025
From: mk1853387 at gmail.com (marc nicole)
Date: Wed, 15 Jan 2025 18:40:43 +0100
Subject: [Tutor] How to weight terms based on semantic importance
Message-ID: <CAGJtH9TYE-MEqSUHWO-JW5j-d2CtUqet7A_R2fn7A25iScGpFg@mail.gmail.com>

Hello,

I want to weight terms of a large text based on their semantics (not on
their frequency (TF-IDF)).
Is there a way to do that using NLTK or other means? through a vectorizer?

For example: a certain term weights more than others etc...

Thanks

From mk1853387 at gmail.com  Wed Jan 22 16:54:12 2025
From: mk1853387 at gmail.com (marc nicole)
Date: Wed, 22 Jan 2025 22:54:12 +0100
Subject: [Tutor] How to properly use py-webrtcvad?
Message-ID: <CAGJtH9SjCNqLBpULYaFWYn-twK1hB36xW8RgvQFnsS6dny9i_w@mail.gmail.com>

Hi,

I am getting audio from my mic using PyAudio as follows:

self.stream = audio.open(format=self.FORMAT,
>                                  channels=self.CHANNELS,
>                                  rate=self.RATE,
>                                  input=True,
>                                  frames_per_buffer=self.FRAMES_PER_BUFFER,
>                                  input_device_index=1)


then reading data as follows:

for i in range(0, int(self.RATE / self.FRAMES_PER_BUFFER *
> self.RECORD_SECONDS)):
>             data = self.stream.read(4800)


on the other hand I am using py-webrtcvad as follows:

self.vad = webrtcvad.Vad()


and want to use *is_speech*() using audio data from PyAudio.
But getting the error:

 return _webrtcvad.process(self._vad, sample_rate, buf, length)
> Error: Error while processing frame


no matter how I changed the input data format (wav: using
speech_recognition's *get_wav_data*(), using numpy...)

Any suggestions (using Python 2.x)?
Thanks.

From haripriyan2003 at gmail.com  Thu Jan 30 08:23:43 2025
From: haripriyan2003 at gmail.com (HARI PRIYAN P V)
Date: Thu, 30 Jan 2025 18:53:43 +0530
Subject: [Tutor] _ctypes module not found in server
Message-ID: <CAFhEPC=Q98jBfJwKN6xPEmW-xQxg=AeDAou4Nz3H-FmV1fMUiQ@mail.gmail.com>

i properly install python libraries version 3.12.0
after execute my code local environment it works fine
but i tring to execute in server it show this error
my server  is cpannel and  os  almalinux 8
it does not have inbult "Python App SetUp "
i do all in terminal
i try all possibilities
installing libffi  but same problem
 re install python
same problem
GIVE A SOLUTION

From oladaposegun62 at gmail.com  Fri Jan 31 02:51:37 2025
From: oladaposegun62 at gmail.com (Dappy Jr)
Date: Fri, 31 Jan 2025 08:51:37 +0100
Subject: [Tutor] Getting error on my code
Message-ID: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>

class Dog():

def _init_(self , name , age):
self.name = name
self.age = age
print(self.name.title() + self.age)

my_dog = Dog('willie' , 6)
print("My dog's name is " + my_dog.name.title() + '.')
print("My dog is " + str(my_dog.age) + 'years old.')


I'm trying to create a class Dog and print with attributes name and age as
'willie' , 6years old. Whenever i run the code i keep getting Dog() takes
no argument error message..

Traceback (most recent call last):
  File "C:\Users\OLADAPO JR\python_work\Classes\dog.py", line 8, in <module>
    my_dog = Dog('willie' , 6)
             ^^^^^^^^^^^^^^^^^
TypeError: Dog() takes no arguments

My OS = Windows
Python Version = 3.12

From alan.gauld at yahoo.co.uk  Fri Jan 31 05:36:28 2025
From: alan.gauld at yahoo.co.uk (Alan Gauld)
Date: Fri, 31 Jan 2025 10:36:28 +0000
Subject: [Tutor] _ctypes module not found in server
In-Reply-To: <CAFhEPC=Q98jBfJwKN6xPEmW-xQxg=AeDAou4Nz3H-FmV1fMUiQ@mail.gmail.com>
References: <CAFhEPC=Q98jBfJwKN6xPEmW-xQxg=AeDAou4Nz3H-FmV1fMUiQ@mail.gmail.com>
Message-ID: <vni93d$1238$1@ciao.gmane.io>

On 30/01/2025 13:23, HARI PRIYAN P V via Tutor wrote:
> i properly install python libraries version 3.12.0
> after execute my code local environment it works fine
> but i tring to execute in server it show this error

Please post the entire error message. It contains a
lot of useful detail.

> my server  is cpannel and  os  almalinux 8
> it does not have inbult "Python App SetUp "
> i do all in terminal
> i try all possibilities

Have you tried the minimal program:

import ctypes

What error does that give?
If it still says it cannot find it check that you
have ctypes installed. Also it could be a path or
environment issue.
Compare the values of sys.path variables between
your environment and the server.
Similarly the PYTHONPATH values


> GIVE A SOLUTION

We need more information for that.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




From alan.gauld at yahoo.co.uk  Fri Jan 31 05:40:26 2025
From: alan.gauld at yahoo.co.uk (Alan Gauld)
Date: Fri, 31 Jan 2025 10:40:26 +0000
Subject: [Tutor] Getting error on my code
In-Reply-To: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
Message-ID: <vni9aq$1238$2@ciao.gmane.io>

On 31/01/2025 07:51, Dappy Jr via Tutor wrote:
> class Dog():
> 
> def _init_(self , name , age):
> self.name = name
> self.age = age
> print(self.name.title() + self.age)
> 

The init() method requires two underscores at each
end not one. With one init() is just another method
of the class and not a constructor/initializer.


Also, in future, please ensure you post in plain text
so that the indentation is preserved. Indentaton is
critical in Python and in any more complex code it
would be impossible to understand it without indentation.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




From leamhall at gmail.com  Fri Jan 31 05:46:29 2025
From: leamhall at gmail.com (Leam Hall)
Date: Fri, 31 Jan 2025 04:46:29 -0600
Subject: [Tutor] Getting error on my code
In-Reply-To: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
Message-ID: <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com>

On 1/31/25 01:51, Dappy Jr via Tutor wrote:
> class Dog():
> 
> def_init_(self , name , age):
> self.name = name
> self.age = age
> print(self.name.title() + self.age)
> 
> my_dog = Dog('willie' , 6)
> print("My dog's name is " + my_dog.name.title() + '.')
> print("My dog is " + str(my_dog.age) + 'years old.')


I'm not sure if your mail client messed up the indentation but here are the changes I made to get it to work:

1. There are 2 underscores, both front and back, on init.    __init__
2. Made the age a string in the __init__ print method.
3. Added a space in the __init__ print method, like you did in the last line.

class Dog():
     def __init__(self , name , age):
         self.name = name
         self.age = age
         print(self.name.title() + " " + str(self.age))

my_dog = Dog('willie' , 6)
print("My dog's name is " + my_dog.name.title() + '.')
print("My dog is " + str(my_dog.age) + 'years old.')



Leam

Linux Software Engineer   (reuel.net/career)
Scribe: The Domici War    (domiciwar.net)
Coding Ne'er-do-well      (github.com/LeamHall)

Between "can" and "can't" is a gap of "I don't know", a place of discovery. For the passionate, much of "can't" falls into "yet". -- lh

Practice allows options and foresight. -- lh


From alan.gauld at yahoo.co.uk  Fri Jan 31 07:10:53 2025
From: alan.gauld at yahoo.co.uk (Alan Gauld)
Date: Fri, 31 Jan 2025 12:10:53 +0000
Subject: [Tutor] Getting error on my code
In-Reply-To: <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com>
Message-ID: <vniekd$hdm$1@ciao.gmane.io>

On 31/01/2025 10:46, Leam Hall via Tutor wrote:

>> def_init_(self , name , age):
>> self.name = name
>> self.age = age
>> print(self.name.title() + self.age)

> 2. Made the age a string in the __init__ print method.

As a matter of interest, why?
print() converts its arguments to strings internally
so why the explicit conversion?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




From leamhall at gmail.com  Fri Jan 31 07:31:55 2025
From: leamhall at gmail.com (Leam Hall)
Date: Fri, 31 Jan 2025 06:31:55 -0600
Subject: [Tutor] Getting error on my code
In-Reply-To: <vniekd$hdm$1@ciao.gmane.io>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com> <vniekd$hdm$1@ciao.gmane.io>
Message-ID: <9160768d-bef1-9d19-76f4-ceaeabf8695f@gmail.com>

On 1/31/25 06:10, Alan Gauld via Tutor wrote:
> On 31/01/2025 10:46, Leam Hall via Tutor wrote:
> 
>>> def_init_(self , name , age):
>>> self.name = name
>>> self.age = age
>>> print(self.name.title() + self.age)
> 
>> 2. Made the age a string in the __init__ print method.
> 
> As a matter of interest, why?
> print() converts its arguments to strings internally
> so why the explicit conversion?


I thought it would as well, but got a TypeError without the str() cast:

[leam at shaphan toys]$ ./dappy.py
Traceback (most recent call last):
   File "/home/leam/lang/python/toys/./dappy.py", line 15, in <module>
     my_dog = Dog('willie' , 6)
              ^^^^^^^^^^^^^^^^^
   File "/home/leam/lang/python/toys/./dappy.py", line 13, in __init__
     print(self.name.title() + " " + self.age)
           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "int") to str

[leam at shaphan toys]$ python -V
Python 3.12.1+


Leam

Linux Software Engineer   (reuel.net/career)
Scribe: The Domici War    (domiciwar.net)
Coding Ne'er-do-well      (github.com/LeamHall)

Between "can" and "can't" is a gap of "I don't know", a place of discovery. For the passionate, much of "can't" falls into "yet". -- lh

Practice allows options and foresight. -- lh

From leamhall at gmail.com  Fri Jan 31 07:36:20 2025
From: leamhall at gmail.com (Leam Hall)
Date: Fri, 31 Jan 2025 06:36:20 -0600
Subject: [Tutor] Getting error on my code
In-Reply-To: <vniekd$hdm$1@ciao.gmane.io>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com> <vniekd$hdm$1@ciao.gmane.io>
Message-ID: <7881e459-801c-4c38-4f8e-3d32f9e0e209@gmail.com>

On 1/31/25 06:10, Alan Gauld via Tutor wrote:
> On 31/01/2025 10:46, Leam Hall via Tutor wrote:
> 
>>> def_init_(self , name , age):
>>> self.name = name
>>> self.age = age
>>> print(self.name.title() + self.age)
> 
>> 2. Made the age a string in the __init__ print method.
> 
> As a matter of interest, why?
> print() converts its arguments to strings internally
> so why the explicit conversion?
> 

Sorry, coffee still kicking in. If we redo the print statement without the concat, it does the conversion:

   print(self.name.title(), self.age)


Leam


Linux Software Engineer   (reuel.net/career)
Scribe: The Domici War    (domiciwar.net)
Coding Ne'er-do-well      (github.com/LeamHall)

Between "can" and "can't" is a gap of "I don't know", a place of discovery. For the passionate, much of "can't" falls into "yet". -- lh

Practice allows options and foresight. -- lh

From alan.gauld at yahoo.co.uk  Fri Jan 31 08:10:27 2025
From: alan.gauld at yahoo.co.uk (Alan Gauld)
Date: Fri, 31 Jan 2025 13:10:27 +0000
Subject: [Tutor] Getting error on my code
In-Reply-To: <7881e459-801c-4c38-4f8e-3d32f9e0e209@gmail.com>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com> <vniekd$hdm$1@ciao.gmane.io>
 <7881e459-801c-4c38-4f8e-3d32f9e0e209@gmail.com>
Message-ID: <vnii43$miq$1@ciao.gmane.io>

On 31/01/2025 12:36, Leam Hall via Tutor wrote:
> On 1/31/25 06:10, Alan Gauld via Tutor wrote:
>> On 31/01/2025 10:46, Leam Hall via Tutor wrote:
>>
>>>> def_init_(self , name , age):
>>>> self.name = name
>>>> self.age = age
>>>> print(self.name.title() + self.age)
>>
>>> 2. Made the age a string in the __init__ print method.
>>
>> As a matter of interest, why?
>> print() converts its arguments to strings internally
>> so why the explicit conversion?
>>
> 
> Sorry, coffee still kicking in. If we redo the print statement without the concat, it does the conversion:
> 
>    print(self.name.title(), self.age)

Yes, the plus made print() treat the whole as a single string
so it would need the str() call.

I should have spotted that too! :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




From threesomequarks at proton.me  Fri Jan 31 10:41:18 2025
From: threesomequarks at proton.me (ThreeBlindQuarks)
Date: Fri, 31 Jan 2025 15:41:18 +0000
Subject: [Tutor] Getting error on my code
In-Reply-To: <vnii43$miq$1@ciao.gmane.io>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com> <vniekd$hdm$1@ciao.gmane.io>
 <7881e459-801c-4c38-4f8e-3d32f9e0e209@gmail.com> <vnii43$miq$1@ciao.gmane.io>
Message-ID: <_D-CJ6VeIZuoA2Ll8GW8lOWZg8amEMLB3tu8Q03hq2V8UflUuhC0KcoYVXiGccKaJtTx979P12A8iui7JrzIrjm395qCFfkW40cPY2rR_B0=@proton.me>

Sometimes a + is not a plus.


Sent with Proton Mail secure email.

On Friday, January 31st, 2025 at 8:10 AM, Alan Gauld via Tutor <tutor at python.org> wrote:

> On 31/01/2025 12:36, Leam Hall via Tutor wrote:
> 
> > On 1/31/25 06:10, Alan Gauld via Tutor wrote:
> > 
> > > On 31/01/2025 10:46, Leam Hall via Tutor wrote:
> > > 
> > > > > def_init_(self , name , age):
> > > > > self.name = name
> > > > > self.age = age
> > > > > print(self.name.title() + self.age)
> > > 
> > > > 2. Made the age a string in the init print method.
> > > 
> > > As a matter of interest, why?
> > > print() converts its arguments to strings internally
> > > so why the explicit conversion?
> > 
> > Sorry, coffee still kicking in. If we redo the print statement without the concat, it does the conversion:
> > 
> > print(self.name.title(), self.age)
> 
> 
> Yes, the plus made print() treat the whole as a single string
> so it would need the str() call.
> 
> I should have spotted that too! :-)
> 
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> 
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

From oladaposegun62 at gmail.com  Fri Jan 31 13:36:06 2025
From: oladaposegun62 at gmail.com (Dappy Jr)
Date: Fri, 31 Jan 2025 19:36:06 +0100
Subject: [Tutor] Getting error on my code
In-Reply-To: <_D-CJ6VeIZuoA2Ll8GW8lOWZg8amEMLB3tu8Q03hq2V8UflUuhC0KcoYVXiGccKaJtTx979P12A8iui7JrzIrjm395qCFfkW40cPY2rR_B0=@proton.me>
References: <CAFOaNTbSGy1D-+iHxQuUcYxowiNP0VMxZ+BR_5mKLEibLJDLNA@mail.gmail.com>
 <9ab46dbc-1140-14b6-7650-9c16ce199904@gmail.com> <vniekd$hdm$1@ciao.gmane.io>
 <7881e459-801c-4c38-4f8e-3d32f9e0e209@gmail.com> <vnii43$miq$1@ciao.gmane.io>
 <_D-CJ6VeIZuoA2Ll8GW8lOWZg8amEMLB3tu8Q03hq2V8UflUuhC0KcoYVXiGccKaJtTx979P12A8iui7JrzIrjm395qCFfkW40cPY2rR_B0=@proton.me>
Message-ID: <CAFOaNTbpOUsPrw+8J9AV106AbFmV-oaZd0qhJo=TekZkjvkhdg@mail.gmail.com>

Thanks y'all for the directions and inputs, it really helped..

On Fri, Jan 31, 2025 at 4:43?PM ThreeBlindQuarks via Tutor <tutor at python.org>
wrote:

> Sometimes a + is not a plus.
>
>
> Sent with Proton Mail secure email.
>
> On Friday, January 31st, 2025 at 8:10 AM, Alan Gauld via Tutor <
> tutor at python.org> wrote:
>
> > On 31/01/2025 12:36, Leam Hall via Tutor wrote:
> >
> > > On 1/31/25 06:10, Alan Gauld via Tutor wrote:
> > >
> > > > On 31/01/2025 10:46, Leam Hall via Tutor wrote:
> > > >
> > > > > > def_init_(self , name , age):
> > > > > > self.name = name
> > > > > > self.age = age
> > > > > > print(self.name.title() + self.age)
> > > >
> > > > > 2. Made the age a string in the init print method.
> > > >
> > > > As a matter of interest, why?
> > > > print() converts its arguments to strings internally
> > > > so why the explicit conversion?
> > >
> > > Sorry, coffee still kicking in. If we redo the print statement without
> the concat, it does the conversion:
> > >
> > > print(self.name.title(), self.age)
> >
> >
> > Yes, the plus made print() treat the whole as a single string
> > so it would need the str() call.
> >
> > I should have spotted that too! :-)
> >
> > --
> > Alan G
> > Author of the Learn to Program web site
> > http://www.alan-g.me.uk/
> > http://www.amazon.com/author/alan_gauld
> > Follow my photo-blog on Flickr at:
> > http://www.flickr.com/photos/alangauldphotos
> >
> >
> >
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>