Re: Fwd: Can you help me with this Python question?

2022-10-13 Thread Axy via Python-list
Well, although I never used pandas and never will, if that's about 
artworks, that's mine.


Obviously, you need to iterate columns and sum values returned by the 
snippet you provided. A quick search tells us to use colums property. 
So, it might look like this:


na_sum = sum(df[name].isnull().sum() for name in df.columns)

Axy

On 13/10/2022 13:44, Sarah Wallace wrote:

For a python class I am taking..

In this challenge, you'll be working with a DataFrame that contains data
about artworks, and it contains many missing values.

Your task is to create a variable called na_sum that contains the total
number of missing values in the DataFrame. When that's completed, print out
your answer!

Hint: The code given below will give you the number of missing (NaN) values
for the *Name* column in the DataFrame. How would you edit the code to get
the missing values for every column in the DataFrame?
Extra hint: You'll be returning a single number which is the final sum() of
everything.

df['Name'].isnull().sum()


--
https://mail.python.org/mailman/listinfo/python-list


Fwd: Can you help me with this Python question?

2022-10-13 Thread Sarah Wallace
For a python class I am taking..

In this challenge, you'll be working with a DataFrame that contains data
about artworks, and it contains many missing values.

Your task is to create a variable called na_sum that contains the total
number of missing values in the DataFrame. When that's completed, print out
your answer!

Hint: The code given below will give you the number of missing (NaN) values
for the *Name* column in the DataFrame. How would you edit the code to get
the missing values for every column in the DataFrame?
Extra hint: You'll be returning a single number which is the final sum() of
everything.

df['Name'].isnull().sum()

-- 
Thanks!

*Sarah Wallace*
sarah.wallac...@gmail.com




-- 
Thanks!

*Sarah Wallace*
sarah.wallac...@gmail.com
214.300.1064
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Python Question re Executing a Script (dn)

2022-05-02 Thread MRAB

On 2022-05-02 17:23, Dennis Lee Bieber wrote:

On Mon, 2 May 2022 20:33:02 +1200, dn 
declaimed the following:


Perhaps an MS-Win user can help the OP, please?


Not really -- at least from my viewpoint there is not enough
information to perform any diagnoses... Other than to recommend that, if
the OP initially posted to the list/newsgroup, they should ensure any
replies also go to the same (I don't respond to what should be group
replies that appear in my personal mail -- which is what the OP did for me
also).

{Hmmm, appears the quoted content is below your signature block, and my
client doesn't quote standard signatures and below... time for some nasty
cut}


From: Brent Hunter 
Date: Mon, 2 May 2022 00:30:22 +




I was recently running a Windows 10 machine and I believe it was running Python 3.8.  All I did was create a batch file 
titled Start-AIG.bat which simply contained the following: "pythonw AIG.py".  It started a python program 
titled "AIG.py" and the Python dialog box was displayed on my screen, running all day and night.  I set up 
Windows to run this batch file upon startup and it worked fine.  I remember having to do a bunch of research before I 
learned that I needed to put "pythonw AIG.py" in the batch file as opposed to "python AIG.py".




[snip]
FTR, I've already posted the suggestion to try the Python Launcher 
"pyw", and the OP replied off-list that it worked.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Python Question re Executing a Script (dn)

2022-05-02 Thread Dennis Lee Bieber
On Mon, 2 May 2022 20:33:02 +1200, dn 
declaimed the following:

>Perhaps an MS-Win user can help the OP, please?

Not really -- at least from my viewpoint there is not enough
information to perform any diagnoses... Other than to recommend that, if
the OP initially posted to the list/newsgroup, they should ensure any
replies also go to the same (I don't respond to what should be group
replies that appear in my personal mail -- which is what the OP did for me
also).

{Hmmm, appears the quoted content is below your signature block, and my
client doesn't quote standard signatures and below... time for some nasty
cut}

>From: Brent Hunter 
>Date: Mon, 2 May 2022 00:30:22 +
>

>I was recently running a Windows 10 machine and I believe it was running 
>Python 3.8.  All I did was create a batch file titled Start-AIG.bat which 
>simply contained the following: "pythonw AIG.py".  It started a python program 
>titled "AIG.py" and the Python dialog box was displayed on my screen, running 
>all day and night.  I set up Windows to run this batch file upon startup and 
>it worked fine.  I remember having to do a bunch of research before I learned 
>that I needed to put "pythonw AIG.py" in the batch file as opposed to "python 
>AIG.py".
>

What in particular is a "Python dialog box"? Python doesn't, of its
own, have dialog boxes. Add-on libraries: Tkinter, wxPython, the win32
extensions, et al. allow one to code scripts that produce dialogs, but the
dialogs are specific to the library.

"pythonw" is the name of the interpreter meant for use with programs
that do not use console I/O -- IOW, pure GUI (one of the aforesaid
libraries).

Normally such programs are given the extension .pyw rather than .py --
and (at least on my system), .pyw files are automatically associated with
pythonw. Just providing the script name with extension is sufficient.
Though there is the matter that giving said name in a command line prompt
means one still has a console active. .pyw files are meant to be started
from the file explorer by double-clicking on them, and one doesn't want to
have a console window popping up if it is never used (which is what happens
if one double-clicks on a plain .py file).


HOW did you "set up Windows to run this batch file upon startup"?

Windows used to support (and still does if
https://www.thewindowsclub.com/startup-folder-in-windows-8 is correct
[ignore the -8, the site is updated for 10/11]). This is per user start up
(unless one uses the "all users" path). The Windows task scheduler also
allows one to create tasks that run on a schedule -- said schedule
including options for specific user logging in, any user logging in,
computer start-up, etc. The scheduler is probably the recommended way to
set up things.


>However, my old windows 10 desktop crashed and I have a new Windows 11 
>machine.  I installed the latest stable version of Python, which is 3.10.  
>Now, when I try to execute the same batch file, it doesn't launch the app.  It 
>could be because I'm using Windows 11 or could be because I now have a newer 
>version of Python.
>
>With this additional information, do you have any ideas what I should do to 
>get the Python script running in the same way I had it running before?

As I stated above -- insufficient information.

Is Python installed for all users or just one?
Is "pythonw" on the system PATH?
Is the script meant to only run for one user or any user?
How was the script configured to start?
Is the script in a valid directory (I believe in a previous post it was
mentioned that you had the script in the directory used for per user
START-MENU entries; that is not meant for user files!).

My first approach would be to open a console and run the script
manually (not the BAT file) -- does any error message appear in the
console? Running using pythonw suppresses console, error messages would be
lost -- GUI applications are expected to trap any runtime errors and either
write to a log file or pop-up a dialog for them.

Then, after getting it to run in a console, I'd try it by
double-clicking on the file (rename it to .pyw so you get the no-console
interpreter). If Windows says it doesn't know how to run .pyw, it implies
that there is no file association set up in Windows telling it how to run
that extension.

NO BAT file should be required for a one-liner that does no parameter
substitution.

If using the "startup" directory method, create a shortcut for the
script (right-click, drag, create shortcut here). Right-click/Properties.
If you don't have associations set to run that extension type, prefix the
Target box with the path to the python(w) executable. Move the shortcut to
the proper startup directory -- Note that if you put it in the all-users
startup, you have to make sure that the script and shortcut themselves are
not in protected (single user) locations.


Fwd: Python Question re Executing a Script (dn)

2022-05-02 Thread dn
Perhaps an MS-Win user can help the OP, please?
-- 
Regards,
=dn--- Begin Message ---
Hello dn,

Thanks for your reply.  My apologies, I should have provided more background 
information.

I was recently running a Windows 10 machine and I believe it was running Python 
3.8.  All I did was create a batch file titled Start-AIG.bat which simply 
contained the following: "pythonw AIG.py".  It started a python program titled 
"AIG.py" and the Python dialog box was displayed on my screen, running all day 
and night.  I set up Windows to run this batch file upon startup and it worked 
fine.  I remember having to do a bunch of research before I learned that I 
needed to put "pythonw AIG.py" in the batch file as opposed to "python AIG.py".

However, my old windows 10 desktop crashed and I have a new Windows 11 machine. 
 I installed the latest stable version of Python, which is 3.10.  Now, when I 
try to execute the same batch file, it doesn't launch the app.  It could be 
because I'm using Windows 11 or could be because I now have a newer version of 
Python.

With this additional information, do you have any ideas what I should do to get 
the Python script running in the same way I had it running before?

Thank you!

Brent

-Original Message-
From: Python-list  On 
Behalf Of dn
Sent: Saturday, April 30, 2022 5:48 PM
To: python-list@python.org
Subject: Re: Python Question re Executing a Script

On 01/05/2022 10.37, Brent Hunter wrote:
> Hello,
> 
> I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
> bit).  I can't figure out from your documentation, how do I:
> 
> 
>   1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
> 
> 
>   1.  How do I automatically run a python app at Windows startup?
> 
> Thank you!
> 
> Brent Hunter


Please start with https://docs.python.org/3/using/windows.html

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list
--- End Message ---
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread Mike Dewhirst

On 1/05/2022 8:37 am, Brent Hunter wrote:

Hello,

I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
bit).  I can't figure out from your documentation, how do I:


   1.  Run a python script that is located in the same directory ( 
C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
3.10 )


   1.  How do I automatically run a python app at Windows startup?


https://www.windowscentral.com/how-launch-apps-automatically-during-login-windows-11

Personally, I write a batch file containing the 'python 
/location/of/script.py' command line and call that batch file. That 
assumes python.exe is on the Windows path.


Once tested and working it lets me edit the batch file to adjust the 
payload without having to touch the Windows stuff again.







Thank you!

Brent Hunter




--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.



OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread Dennis Lee Bieber
On Sat, 30 Apr 2022 22:37:35 +, Brent Hunter 
declaimed the following:

>Hello,
>
>I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
>bit).  I can't figure out from your documentation, how do I:
>
>
>  1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
>

ONE: that path indicates that you installed Python "for current user
only".

TWO: that is the path for the short cut entry that shows up on the
Windows "Start Menu" (whatever that looks like on Win11). It is NOT a
location for user scripts.

Python, at heart, is a language interpreter that is invoked from a
command line shell. (Use  to exit the interpreter if you are trying
the below examples -- otherwise you'd add the path/name of the script file
to the command line)

-=-=-
Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>python
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>py
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>
-=-=-

It can run from scripts invoked by double-clicking on the file in the
"file explorer" but often the results are not as desired (it will pop up a
console window -- but that window closes as soon as the script exits!).
Scripts written using one of the graphical libraries (Tkinter, wxPython,
etc.) are typically given a .pyw extension -- .pyw is normally associated
with an alternate start-up module which suppresses the console window.

Editing of scripts can be done with one's favorite programming text
editor. If one can't live without having some sort of IDE, look for
something called IDLE to be on your start menu (IDLE is actually a Python
script using Tkinter).

>
>  1.  How do I automatically run a python app at Windows startup?

Short answer: the same way you would run ANY application at start-up. 

Longer answer: this is a feature of the OS, not Python. You will need
to learn how to use the OS. Maybe start with
https://www.google.com/search?q=run+application+at+startup+windows+11=hp=t1htYpm0K5OtqtsPiMKMwAc=AJiK0e8AYm1mx0aL7YbWlEj0j-yPiL8J4H8HFoxo=0ahUKEwjZ6-T3j7z3AhWTlmoFHQghA3gQ4dUDCAk=5=run+application+at+startup+windows+11_lcp=Cgdnd3Mtd2l6EAMyBQghEKsCMgUIIRCrAjIFCCEQqwIyCAghEBYQHRAeOgUIABCABDoOCC4QgAQQsQMQgwEQ1AI6CAgAEIAEELEDOhEILhCABBCxAxCDARDHARDRAzoICC4QgAQQsQM6CwgAEIAEELEDEIMBOggILhCxAxCDAToFCC4QgAQ6EQguEIAEELEDEIMBEMcBEKMCOgsILhCABBDHARCjAjoICC4QgAQQ1AI6CwguEIAEELEDEIMBOgsILhCABBCxAxDUAjoOCC4QsQMQgwEQxwEQowI6DgguEIAEELEDEMcBENEDOg4ILhCABBCxAxCDARDJAzoICAAQsQMQgwE6BwgAEIAEEAo6CAgAEIAEEMkDOgYIABAWEB46BQgAEIYDUL0NWNRZYO9caAFwAHgBgAHYAYgBpx6SAQcyNC4xMi4xmAEAoAEBsAEA=gws-wiz

>
>Thank you!
>
>Brent Hunter


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread dn
On 01/05/2022 10.37, Brent Hunter wrote:
> Hello,
> 
> I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
> bit).  I can't figure out from your documentation, how do I:
> 
> 
>   1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
> 
> 
>   1.  How do I automatically run a python app at Windows startup?
> 
> Thank you!
> 
> Brent Hunter


Please start with https://docs.python.org/3/using/windows.html

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Python Question re Executing a Script

2022-04-30 Thread Brent Hunter
Hello,

I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
bit).  I can't figure out from your documentation, how do I:


  1.  Run a python script that is located in the same directory ( 
C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
3.10 )


  1.  How do I automatically run a python app at Windows startup?

Thank you!

Brent Hunter

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: basic Python question

2020-05-08 Thread MRAB

On 2020-05-08 21:19, joseph pareti wrote:

yet, something is still unclear; in Python you can do things like:

*clf0.fit(X_train,y_train)*

which is not the way I programmed in other languages where a left-hand 
side and a right hand side is required.


All it's doing is performing the calculation and then storing the result 
in the object itself. Most other languages can do that too.


Am Fr., 8. Mai 2020 um 21:52 Uhr schrieb joseph pareti 
mailto:joeparet...@gmail.com>>:


yes, it is random forest classifier from scikit learn. Thank you.

Am Fr., 8. Mai 2020 um 21:50 Uhr schrieb MRAB
mailto:pyt...@mrabarnett.plus.com>>:

On 2020-05-08 20:02, joseph pareti wrote:
> In general I prefer doing:
>
>
> X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.33, random_state=42)
 >clf = RandomForestClassifier(n_estimators = 100, max_depth=
> None) *clf_f = clf.fit(X_train, y_train)* predicted_labels =
clf_f.predict(
> X_test) score = clf.score(X_test, y_test) score1 =
metrics.accuracy_score(
> y_test, predicted_labels)
>
>
> rather than:
>
> X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.33,
> random_state=42)
clf0=RandomForestClassifier(n_estimators=100, max_depth=
> None) *clf0.fit(X_train, y_train)* y_pred
=clf0.predict(X_test) score=
> metrics.accuracy_score(y_test, y_pred)
>
>
> Are the two codes really equivalent?
>
You didn't give any context and say what package you're using!

After searching for "RandomForestClassifier", I'm guessing
that you're
using scikit.

 From the documentation here:


https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.fit

it says:

     Returns: self : object

so it looks like clf.fit(...) returns clf.

That being the case, then, yes, they're equivalent.




--
https://mail.python.org/mailman/listinfo/python-list


Re: basic Python question

2020-05-08 Thread joseph pareti
yet, something is still unclear; in Python you can do things like:

*clf0.fit(X_train, y_train)*

which is not the way I programmed in other languages where a left-hand side
and a right hand side is required.

Am Fr., 8. Mai 2020 um 21:52 Uhr schrieb joseph pareti <
joeparet...@gmail.com>:

> yes, it is random forest classifier from scikit learn. Thank you.
>
> Am Fr., 8. Mai 2020 um 21:50 Uhr schrieb MRAB  >:
>
>> On 2020-05-08 20:02, joseph pareti wrote:
>> > In general I prefer doing:
>> >
>> >
>> > X_train, X_test, y_train, y_test = train_test_split(X, y,
>> test_size=0.33, random_state=42)
>>  >clf = RandomForestClassifier(n_estimators = 100, max_depth=
>> > None) *clf_f = clf.fit(X_train, y_train)* predicted_labels =
>> clf_f.predict(
>> > X_test) score = clf.score(X_test, y_test) score1 =
>> metrics.accuracy_score(
>> > y_test, predicted_labels)
>> >
>> >
>> > rather than:
>> >
>> > X_train, X_test, y_train, y_test = train_test_split(X, y,
>> test_size=0.33,
>> > random_state=42) clf0=RandomForestClassifier(n_estimators=100,
>> max_depth=
>> > None) *clf0.fit(X_train, y_train)* y_pred =clf0.predict(X_test) score=
>> > metrics.accuracy_score(y_test, y_pred)
>> >
>> >
>> > Are the two codes really equivalent?
>> >
>> You didn't give any context and say what package you're using!
>>
>> After searching for "RandomForestClassifier", I'm guessing that you're
>> using scikit.
>>
>>  From the documentation here:
>>
>>
>> https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.fit
>>
>> it says:
>>
>>  Returns: self : object
>>
>> so it looks like clf.fit(...) returns clf.
>>
>> That being the case, then, yes, they're equivalent.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
> --
> Regards,
> Joseph Pareti - Artificial Intelligence consultant
> Joseph Pareti's AI Consulting Services
> https://www.joepareti54-ai.com/
> cell +49 1520 1600 209
> cell +39 339 797 0644
>


-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: basic Python question

2020-05-08 Thread joseph pareti
yes, it is random forest classifier from scikit learn. Thank you.

Am Fr., 8. Mai 2020 um 21:50 Uhr schrieb MRAB :

> On 2020-05-08 20:02, joseph pareti wrote:
> > In general I prefer doing:
> >
> >
> > X_train, X_test, y_train, y_test = train_test_split(X, y,
> test_size=0.33, random_state=42)
>  >clf = RandomForestClassifier(n_estimators = 100, max_depth=
> > None) *clf_f = clf.fit(X_train, y_train)* predicted_labels =
> clf_f.predict(
> > X_test) score = clf.score(X_test, y_test) score1 =
> metrics.accuracy_score(
> > y_test, predicted_labels)
> >
> >
> > rather than:
> >
> > X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
> > random_state=42) clf0=RandomForestClassifier(n_estimators=100, max_depth=
> > None) *clf0.fit(X_train, y_train)* y_pred =clf0.predict(X_test) score=
> > metrics.accuracy_score(y_test, y_pred)
> >
> >
> > Are the two codes really equivalent?
> >
> You didn't give any context and say what package you're using!
>
> After searching for "RandomForestClassifier", I'm guessing that you're
> using scikit.
>
>  From the documentation here:
>
>
> https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.fit
>
> it says:
>
>  Returns: self : object
>
> so it looks like clf.fit(...) returns clf.
>
> That being the case, then, yes, they're equivalent.
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: basic Python question

2020-05-08 Thread MRAB

On 2020-05-08 20:02, joseph pareti wrote:

In general I prefer doing:


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, 
random_state=42)

>clf = RandomForestClassifier(n_estimators = 100, max_depth=

None) *clf_f = clf.fit(X_train, y_train)* predicted_labels = clf_f.predict(
X_test) score = clf.score(X_test, y_test) score1 = metrics.accuracy_score(
y_test, predicted_labels)


rather than:

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
random_state=42) clf0=RandomForestClassifier(n_estimators=100, max_depth=
None) *clf0.fit(X_train, y_train)* y_pred =clf0.predict(X_test) score=
metrics.accuracy_score(y_test, y_pred)


Are the two codes really equivalent?


You didn't give any context and say what package you're using!

After searching for "RandomForestClassifier", I'm guessing that you're 
using scikit.


From the documentation here:

https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.fit

it says:

Returns: self : object

so it looks like clf.fit(...) returns clf.

That being the case, then, yes, they're equivalent.
--
https://mail.python.org/mailman/listinfo/python-list


basic Python question

2020-05-08 Thread joseph pareti
In general I prefer doing:


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
random_state=42) clf = RandomForestClassifier(n_estimators = 100, max_depth=
None) *clf_f = clf.fit(X_train, y_train)* predicted_labels = clf_f.predict(
X_test) score = clf.score(X_test, y_test) score1 = metrics.accuracy_score(
y_test, predicted_labels)






rather than:

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
random_state=42) clf0=RandomForestClassifier(n_estimators=100, max_depth=
None) *clf0.fit(X_train, y_train)* y_pred =clf0.predict(X_test) score=
metrics.accuracy_score(y_test, y_pred)














Are the two codes really equivalent?
-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-13 Thread Michael Torrie
On 3/12/20 4:19 PM, Mike Dewhirst wrote:
> I'm not sure I understand what you are saying. How is gmail
> behaviour breaking things?

The problem is if I post to a mailing list from gmail (either the web
interface or Thunderbird via Google's SMTP servers), Google will
silently discard my own message when the list serv echos it back to me.
In the web-based "conversation" view, Google puts my own sent message in
the conversation. However via IMAP I see nothing.  Thus when looking at
my list mail on Thunderbird, my own messages to the list never show up.

Does that make sense?  There was a lot of fuss about this when gmail
first started doing this, but Google ignored it and continues to ignore
this issue. They regard this sort of email use as "legacy."

Here's an old message describing the problem and showing Google's
non-response:
https://support.google.com/mail/forum/K7un8RUduyrfxS01ac/?hl=en

The only way to prevent this is to send your message via a non-Gmail
SMTP server, and not to put those messages in your Gmail Sent folder.
This runs the risk of messages being flagged as untrustworthy, but as
long as Python's smtp server accepts them, it works.  Of course python's
list messages going out are often flagged as suspicious because they
have our own "from" addresses on them but come through Python's servers.

> I do have a gmail account but don't use it.
> 
> As background, I signed up to the Django google-group list and
> traffic there arrives in my Thunderbird client. I also occasionally
> use Roundcube web client for my accounts when travelling. I think
> that might be a php thing.
> 
> Maybe there is a case for developing a gmail-like web client?

No the problem has nothing to do with the web interface or the client.
It's a bug/feature of the Google back end.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-12 Thread Michael Torrie
On 3/11/20 8:47 PM, DL Neil via Python-list wrote:
> Didn't someone once claim "do no harm"?
> 
> There are two sides to every story! Rather than changing the (Discussion 
> List) server, which affects everyone; ask those who don't like Google's 
> tactics/behavior to change their (email) client!

In Gmail's case it's a matter of not using gmail at all, as their
mailing list -breaking behavior happens whether you use IMAP and
thunderbird.  I work around gmail's breakage right now by using my own
SMTP server for sending messages to the list, so gmail won't recognize
my messages and discard them.

I could leave gmail, but it's not worth it for me at this point.  Python
is the only mailing list left of all the open source projects I used to
follow. It's pretty sad how they all abandoned a format that works very
well for web based formats.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-12 Thread Souvik Dutta
Ya at least I thought that.

On Thu, Mar 12, 2020, 12:45 PM Mike Dewhirst  wrote:

> On 12/03/2020 1:47 pm, DL Neil via Python-list wrote:
> > On 12/03/20 3:03 AM, Rhodri James wrote:
> >> On 11/03/2020 04:06, Michael Torrie wrote:
> >>> On 3/10/20 6:49 PM, Souvik Dutta wrote:
>  What about moving on to a social media app completely made in
>  pythoj for
>  python?
> >>> No thanks. I don't want to be on yet another web forum.  I don't need
> >>> "social media" or a "social media app."  Email works exceedingly well
> >>> for this sort of thing, despite Google's antics.
> >>
> >> +10
> >>
> >> The best response to "This system breaks when I abuse it" is almost
> >> always "Well stop abusing it then."
> >
> >
> > +1
> >
> > Didn't someone once claim "do no harm"?
> >
> > There are two sides to every story! Rather than changing the
> > (Discussion List) server, which affects everyone; ask those who don't
> > like Google's tactics/behavior to change their (email) client!
> >
>
> I agree email is better than social media, but I suspect Souvik was
> merely expressing a desire to do something in Python since this is a
> Python list. That's the motivation of a Python enthusiast and perhaps
> should be encouraged.
>
>
>
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-12 Thread Mike Dewhirst

On 12/03/2020 1:47 pm, DL Neil via Python-list wrote:

On 12/03/20 3:03 AM, Rhodri James wrote:

On 11/03/2020 04:06, Michael Torrie wrote:

On 3/10/20 6:49 PM, Souvik Dutta wrote:
What about moving on to a social media app completely made in 
pythoj for

python?

No thanks. I don't want to be on yet another web forum.  I don't need
"social media" or a "social media app."  Email works exceedingly well
for this sort of thing, despite Google's antics.


+10

The best response to "This system breaks when I abuse it" is almost 
always "Well stop abusing it then."



+1

Didn't someone once claim "do no harm"?

There are two sides to every story! Rather than changing the 
(Discussion List) server, which affects everyone; ask those who don't 
like Google's tactics/behavior to change their (email) client!




I agree email is better than social media, but I suspect Souvik was 
merely expressing a desire to do something in Python since this is a 
Python list. That's the motivation of a Python enthusiast and perhaps 
should be encouraged.







--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-11 Thread DL Neil via Python-list

On 12/03/20 3:03 AM, Rhodri James wrote:

On 11/03/2020 04:06, Michael Torrie wrote:

On 3/10/20 6:49 PM, Souvik Dutta wrote:

What about moving on to a social media app completely made in pythoj for
python?

No thanks. I don't want to be on yet another web forum.  I don't need
"social media" or a "social media app."  Email works exceedingly well
for this sort of thing, despite Google's antics.


+10

The best response to "This system breaks when I abuse it" is almost 
always "Well stop abusing it then."



+1

Didn't someone once claim "do no harm"?

There are two sides to every story! Rather than changing the (Discussion 
List) server, which affects everyone; ask those who don't like Google's 
tactics/behavior to change their (email) client!


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-11 Thread Grant Edwards
On 2020-03-11, Michael Torrie  wrote:
> On 3/10/20 6:49 PM, Souvik Dutta wrote:
>> What about moving on to a social media app completely made in pythoj for
>> python?
>
> No thanks. I don't want to be on yet another web forum.  I don't need
> "social media" or a "social media app."  Email works exceedingly well
> for this sort of thing, despite Google's antics.

For me, "news" works even better than email, which is why I read all
my email lists via the gmane NNTP server using a news client (slrn). :)

-- 
Grant Edwards   grant.b.edwardsYow! Now I'm concentrating
  at   on a specific tank battle
  gmail.comtoward the end of World
   War II!

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-11 Thread Rhodri James

On 11/03/2020 04:06, Michael Torrie wrote:

On 3/10/20 6:49 PM, Souvik Dutta wrote:

What about moving on to a social media app completely made in pythoj for
python?

No thanks. I don't want to be on yet another web forum.  I don't need
"social media" or a "social media app."  Email works exceedingly well
for this sort of thing, despite Google's antics.


+10

The best response to "This system breaks when I abuse it" is almost 
always "Well stop abusing it then."


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Michael Torrie
On 3/10/20 6:49 PM, Souvik Dutta wrote:
> What about moving on to a social media app completely made in pythoj for
> python?

No thanks. I don't want to be on yet another web forum.  I don't need
"social media" or a "social media app."  Email works exceedingly well
for this sort of thing, despite Google's antics.

Sadly a lot of open source projects are abandoning the good old list and
moving to awkward web forums like Discourse.

With e-mail lists, everything is right here in my email client
(Thunderbird), separated out into folders with procmail (or whatever
filtering system you want), and with proper nesting of messages.  No web
forum I've seen offers this convenience or proper nesting.  Electronic
communication is fraught enough. "Social media" (whatever that means)
seems to just make it harder.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Souvik Dutta
What about moving on to a social media app completely made in pythoj for
python?

On Wed, 11 Mar, 2020, 12:36 am DL Neil via Python-list, <
python-list@python.org> wrote:

> On 11/03/20 7:34 AM, Michael Torrie wrote:
> > On 3/10/20 6:40 AM, Chris Angelico wrote:
> >> On Tue, Mar 10, 2020 at 11:22 PM Marco Sulla via Python-list
> ...
>
> >> I'm also reading this in Gmail, and I didn't get any such warning. I'm
> >> going to call that a spurious warning, a false positive.
> >
> > Gmail often reports this about Python list messages because they are
> > being sent through Python's mailing list servers but have the From
> > address showing up as the poster's email address.
> >
> > Shows that Google's "my way or the highway" approach to security is
> > problematic when it comes to traditional internet services like
> > listservs.  To say nothing of how they break mailing lists by throwing
> > out your own messages to the list. Google products are definitely
> > getting more and more frustrating for us traditional users.
>
> +1
>
> ...and any right-of-reply is basically-hidden and then swathed in all
> manner of bureaucracy - which is why it not worth our long-suffering
> ListAdmins' (thanks guys!) time to attempt a fix!
>
> OT: Google is not the only over-large and over-bearing outfit...
>
> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread DL Neil via Python-list

On 11/03/20 7:34 AM, Michael Torrie wrote:

On 3/10/20 6:40 AM, Chris Angelico wrote:

On Tue, Mar 10, 2020 at 11:22 PM Marco Sulla via Python-list

...


I'm also reading this in Gmail, and I didn't get any such warning. I'm
going to call that a spurious warning, a false positive.


Gmail often reports this about Python list messages because they are
being sent through Python's mailing list servers but have the From
address showing up as the poster's email address.

Shows that Google's "my way or the highway" approach to security is
problematic when it comes to traditional internet services like
listservs.  To say nothing of how they break mailing lists by throwing
out your own messages to the list. Google products are definitely
getting more and more frustrating for us traditional users.


+1

...and any right-of-reply is basically-hidden and then swathed in all 
manner of bureaucracy - which is why it not worth our long-suffering 
ListAdmins' (thanks guys!) time to attempt a fix!


OT: Google is not the only over-large and over-bearing outfit...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Michael Torrie
On 3/10/20 6:40 AM, Chris Angelico wrote:
> On Tue, Mar 10, 2020 at 11:22 PM Marco Sulla via Python-list
>> I would reply, but I was already too much off topic. I want only to
>> write what Gmail reports to me about the last message of the person
>> that started this discussion:
>>
>>> This message seems dangerous
>>> Many people marked similar messages as phishing scams, so this might 
>>> contain unsafe content. Avoid clicking links, downloading attachments or 
>>> replying with personal information.
>>
>> I never saw this message before in Gmail. Didn't your Gmail warned
>> about this, Souvik Dutta?
>>
> 
> I'm also reading this in Gmail, and I didn't get any such warning. I'm
> going to call that a spurious warning, a false positive.

Gmail often reports this about Python list messages because they are
being sent through Python's mailing list servers but have the From
address showing up as the poster's email address.

Shows that Google's "my way or the highway" approach to security is
problematic when it comes to traditional internet services like
listservs.  To say nothing of how they break mailing lists by throwing
out your own messages to the list. Google products are definitely
getting more and more frustrating for us traditional users.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Chris Angelico
On Tue, Mar 10, 2020 at 11:22 PM Marco Sulla via Python-list
 wrote:
>
> On Fri, 6 Mar 2020 at 17:30, Souvik Dutta  wrote:
> > And you cannot form opinions for
> > other people's by saying them not to support a person. That is injustice
> > and rude.
>
> I would reply, but I was already too much off topic. I want only to
> write what Gmail reports to me about the last message of the person
> that started this discussion:
>
> > This message seems dangerous
> > Many people marked similar messages as phishing scams, so this might 
> > contain unsafe content. Avoid clicking links, downloading attachments or 
> > replying with personal information.
>
> I never saw this message before in Gmail. Didn't your Gmail warned
> about this, Souvik Dutta?
>

I'm also reading this in Gmail, and I didn't get any such warning. I'm
going to call that a spurious warning, a false positive.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Marco Sulla via Python-list
On Fri, 6 Mar 2020 at 17:30, Souvik Dutta  wrote:
> And you cannot form opinions for
> other people's by saying them not to support a person. That is injustice
> and rude.

I would reply, but I was already too much off topic. I want only to
write what Gmail reports to me about the last message of the person
that started this discussion:

> This message seems dangerous
> Many people marked similar messages as phishing scams, so this might contain 
> unsafe content. Avoid clicking links, downloading attachments or replying 
> with personal information.

I never saw this message before in Gmail. Didn't your Gmail warned
about this, Souvik Dutta?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-08 Thread Peter J. Holzer
On 2020-03-05 20:49:14 -0800, Mr. Lee Chiffre wrote:
> > 2. he does not trust binaries from pip.
> 
> What is the point of open source if you cannot compile from source code?

You can get the source code from pypi. I don't see any option for pip to
do that, but you can easily do it manually.

If you don't trust the binaries from pypi, don't trust the source code
either! Malware has been found on npm, for example. So to be sure there
are no backdoors you have to (carefully) read the source of each module
you use (which makes the time for downloading them manually trivial).

Oh, and you have read "Reflections on Trusting Trust", I presume?


> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.

It's still open source if the source is available (under the usual
conditions). Whether you trust somebody else to compile the software is
a question of trust, not of openness. Do you trust the person who
compiled your compiler?

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Python question

2020-03-07 Thread Mr . Lee Chiffre
Thank you Marco for at least taking the time to read my message even if you do 
not agree with me on things. And no disrespect to you. But I came here for 
python related questions and help. Not to be called suspicious and 
untrustworthy only because I am concerned about security of users and for being 
a advocate of privacy. Then to call for me to be censored is just ludicrous.


> People of Python List, I strongly discourage you to support this user.
> He is quite suspicious for the following reasons:
>
> 1. he go so far as he offers money for, IMHO, a trivial task

I said I am a python noob. This is why I asked for help. And I see no issue in 
offering payment for a programming task.

> 2. he does not trust binaries from pip.

What is the point of open source if you cannot compile from source code?

> code. A lack of trust in open source projects that is quite unusual
> 3. I don't trust any cryptocurrency.

Not unusual. People use open source because they dont trust closed source. 
Binaries that someone else compiled is not open source.

> I believe in privacy,  but not in financial privacy. Yes,
> cryptocurrencies can be useful for circumvent bans from tyrannic
> states. But they can, and _are_ used, primarily to:
>  - wash dirty money, by criminals and mafias
>  - evade taxes
>  - buy highly unethical "products", like weapons... and who know what
> other
>  - finance tyrannies.

Roads and cars are used by drug dealers. Stop using roads and cars. Cash is 
used by criminals. Stop using cash. Internet is used by child abusers. Stop 
supporting the internet. I am offended that you group me with criminals and 
baddies because I support technological privacy.


>
> I do _not_ think that all people that uses cryptocurrencies are
> criminals. I had, for example, some co-workers that invested in
> BitCoins, only for profit.
>
> But I do not trust this man, and I hope no one will offer support to
> him. By my side, I'll report this discussion to moderators.

That is fine if you dont like something. You dont have to help me out if you 
dont want to. But trying to censor me is unethical. Hopefully other people will 
have the logic to make decisions for themselves and give me help on python if 
they choose to do so.

I hope my reply does not get censored. I am being reasonable here. And if you 
are wondering why I am "paranoid", you would be too if you are dealing with a 
server that might host a hot wallet. I dont want my server getting hacked just 
because I was too lazy to compile my own code. And it is not uncommon for 
binaries of open source projects to be injected with malware.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-07 Thread Souvik Dutta
This is not a place to quarrel our only task is to discuss and help other learn 
and learn ourselves. To Mr. Marco what Mr. Lee says is correct. Since he is 
working on a cryptocurrency project and he might use our original code in his 
final project I don't think offering money is bad. After all there have been 
times when a person demands his name to included in the credits page. Our sole 
task is to help. And you cannot form opinions for other people's by saying them 
not to support a person. That is injustice and rude.

On Fri, 6 Mar, 2020, 9:14 pm Mr. Lee Chiffre,  wrote:

> Thank you Marco for at least taking the time to read my message even if
> you do not agree with me on things. And no disrespect to you. But I came
> here for python related questions and help. Not to be called suspicious
> and untrustworthy only because I am concerned about security of users and
> for being a advocate of privacy. Then to call for me to be censored is
> just ludicrous.
>
>
> > People of Python List, I strongly discourage you to support this user.
> > He is quite suspicious for the following reasons:
> >
> > 1. he go so far as he offers money for, IMHO, a trivial task
>
> I said I am a python noob. This is why I asked for help. And I see no
> issue in offering payment for a programming task.
>
> > 2. he does not trust binaries from pip.
>
> What is the point of open source if you cannot compile from source code?
>
> > code. A lack of trust in open source projects that is quite unusual
> > 3. I don't trust any cryptocurrency.
>
> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.
>
> > I believe in privacy,  but not in financial privacy. Yes,
> > cryptocurrencies can be useful for circumvent bans from tyrannic
> > states. But they can, and _are_ used, primarily to:
> >  - wash dirty money, by criminals and mafias
> >  - evade taxes
> >  - buy highly unethical "products", like weapons... and who know what
> > other
> >  - finance tyrannies.
>
> Roads and cars are used by drug dealers. Stop using roads and cars. Cash
> is used by criminals. Stop using cash. Internet is used by child abusers.
> Stop supporting the internet. I am offended that you group me with
> criminals and baddies because I support technological privacy.
>
>
> >
> > I do _not_ think that all people that uses cryptocurrencies are
> > criminals. I had, for example, some co-workers that invested in
> > BitCoins, only for profit.
> >
> > But I do not trust this man, and I hope no one will offer support to
> > him. By my side, I'll report this discussion to moderators.
>
> That is fine if you dont like something. You dont have to help me out if
> you dont want to. But trying to censor me is unethical. Hopefully other
> people will have the logic to make decisions for themselves and give me
> help on python if they choose to do so.
>
> I hope my reply does not get censored. I am being reasonable here. And if
> you are wondering why I am "paranoid", you would be too if you are dealing
> with a server that might host a hot wallet. I dont want my server getting
> hacked just because I was too lazy to compile my own code. And it is not
> uncommon for binaries of open source projects to be injected with malware.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python question

2020-03-06 Thread Mr . Lee Chiffre
Thank you Marco for at least taking the time to read my message even if you do 
not agree with me on things. And no disrespect to you. But I came here for 
python related questions and help. Not to be called suspicious and 
untrustworthy only because I am concerned about security of users and for being 
a advocate of privacy. Then to call for me to be censored is just ludicrous.


> People of Python List, I strongly discourage you to support this user.
> He is quite suspicious for the following reasons:
>
> 1. he go so far as he offers money for, IMHO, a trivial task

I said I am a python noob. This is why I asked for help. And I see no issue in 
offering payment for a programming task.

> 2. he does not trust binaries from pip.

What is the point of open source if you cannot compile from source code?

> code. A lack of trust in open source projects that is quite unusual
> 3. I don't trust any cryptocurrency.

Not unusual. People use open source because they dont trust closed source. 
Binaries that someone else compiled is not open source.

> I believe in privacy,  but not in financial privacy. Yes,
> cryptocurrencies can be useful for circumvent bans from tyrannic
> states. But they can, and _are_ used, primarily to:
>  - wash dirty money, by criminals and mafias
>  - evade taxes
>  - buy highly unethical "products", like weapons... and who know what
> other
>  - finance tyrannies.

Roads and cars are used by drug dealers. Stop using roads and cars. Cash is 
used by criminals. Stop using cash. Internet is used by child abusers. Stop 
supporting the internet. I am offended that you group me with criminals and 
baddies because I support technological privacy.


>
> I do _not_ think that all people that uses cryptocurrencies are
> criminals. I had, for example, some co-workers that invested in
> BitCoins, only for profit.
>
> But I do not trust this man, and I hope no one will offer support to
> him. By my side, I'll report this discussion to moderators.

That is fine if you dont like something. You dont have to help me out if you 
dont want to. But trying to censor me is unethical. Hopefully other people will 
have the logic to make decisions for themselves and give me help on python if 
they choose to do so.

I hope my reply does not get censored. I am being reasonable here. And if you 
are wondering why I am "paranoid", you would be too if you are dealing with a 
server that might host a hot wallet. I dont want my server getting hacked just 
because I was too lazy to compile my own code. And it is not uncommon for 
binaries of open source projects to be injected with malware.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-06 Thread Souvik Dutta
This is not a place to quarrel our only task is to discuss and help other learn 
and learn ourselves. To Mr. Marco what Mr. Lee says is correct. Since he is 
working on a cryptocurrency project and he might use our original code in his 
final project I don't think offering money is bad. After all there have been 
times when a person demands his name to included in the credits page. Our sole 
task is to help. And you cannot form opinions for other people's by saying them 
not to support a person. That is injustice and rude.

On Fri, 6 Mar, 2020, 9:14 pm Mr. Lee Chiffre,  wrote:

> Thank you Marco for at least taking the time to read my message even if
> you do not agree with me on things. And no disrespect to you. But I came
> here for python related questions and help. Not to be called suspicious
> and untrustworthy only because I am concerned about security of users and
> for being a advocate of privacy. Then to call for me to be censored is
> just ludicrous.
>
>
> > People of Python List, I strongly discourage you to support this user.
> > He is quite suspicious for the following reasons:
> >
> > 1. he go so far as he offers money for, IMHO, a trivial task
>
> I said I am a python noob. This is why I asked for help. And I see no
> issue in offering payment for a programming task.
>
> > 2. he does not trust binaries from pip.
>
> What is the point of open source if you cannot compile from source code?
>
> > code. A lack of trust in open source projects that is quite unusual
> > 3. I don't trust any cryptocurrency.
>
> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.
>
> > I believe in privacy,  but not in financial privacy. Yes,
> > cryptocurrencies can be useful for circumvent bans from tyrannic
> > states. But they can, and _are_ used, primarily to:
> >  - wash dirty money, by criminals and mafias
> >  - evade taxes
> >  - buy highly unethical "products", like weapons... and who know what
> > other
> >  - finance tyrannies.
>
> Roads and cars are used by drug dealers. Stop using roads and cars. Cash
> is used by criminals. Stop using cash. Internet is used by child abusers.
> Stop supporting the internet. I am offended that you group me with
> criminals and baddies because I support technological privacy.
>
>
> >
> > I do _not_ think that all people that uses cryptocurrencies are
> > criminals. I had, for example, some co-workers that invested in
> > BitCoins, only for profit.
> >
> > But I do not trust this man, and I hope no one will offer support to
> > him. By my side, I'll report this discussion to moderators.
>
> That is fine if you dont like something. You dont have to help me out if
> you dont want to. But trying to censor me is unethical. Hopefully other
> people will have the logic to make decisions for themselves and give me
> help on python if they choose to do so.
>
> I hope my reply does not get censored. I am being reasonable here. And if
> you are wondering why I am "paranoid", you would be too if you are dealing
> with a server that might host a hot wallet. I dont want my server getting
> hacked just because I was too lazy to compile my own code. And it is not
> uncommon for binaries of open source projects to be injected with malware.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-06 Thread Souvik Dutta
This is not a place to quarrel our only task is to discuss and help other learn 
and learn ourselves. To Mr. Marco what Mr. Lee says is correct. Since he is 
working on a cryptocurrency project and he might use our original code in his 
final project I don't think offering money is bad. After all there have been 
times when a person demands his name to included in the credits page. Our sole 
task is to help. And you cannot form opinions for other people's by saying them 
not to support a person. That is injustice and rude.

On Fri, 6 Mar, 2020, 9:14 pm Mr. Lee Chiffre,  wrote:

> Thank you Marco for at least taking the time to read my message even if
> you do not agree with me on things. And no disrespect to you. But I came
> here for python related questions and help. Not to be called suspicious
> and untrustworthy only because I am concerned about security of users and
> for being a advocate of privacy. Then to call for me to be censored is
> just ludicrous.
>
>
> > People of Python List, I strongly discourage you to support this user.
> > He is quite suspicious for the following reasons:
> >
> > 1. he go so far as he offers money for, IMHO, a trivial task
>
> I said I am a python noob. This is why I asked for help. And I see no
> issue in offering payment for a programming task.
>
> > 2. he does not trust binaries from pip.
>
> What is the point of open source if you cannot compile from source code?
>
> > code. A lack of trust in open source projects that is quite unusual
> > 3. I don't trust any cryptocurrency.
>
> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.
>
> > I believe in privacy,  but not in financial privacy. Yes,
> > cryptocurrencies can be useful for circumvent bans from tyrannic
> > states. But they can, and _are_ used, primarily to:
> >  - wash dirty money, by criminals and mafias
> >  - evade taxes
> >  - buy highly unethical "products", like weapons... and who know what
> > other
> >  - finance tyrannies.
>
> Roads and cars are used by drug dealers. Stop using roads and cars. Cash
> is used by criminals. Stop using cash. Internet is used by child abusers.
> Stop supporting the internet. I am offended that you group me with
> criminals and baddies because I support technological privacy.
>
>
> >
> > I do _not_ think that all people that uses cryptocurrencies are
> > criminals. I had, for example, some co-workers that invested in
> > BitCoins, only for profit.
> >
> > But I do not trust this man, and I hope no one will offer support to
> > him. By my side, I'll report this discussion to moderators.
>
> That is fine if you dont like something. You dont have to help me out if
> you dont want to. But trying to censor me is unethical. Hopefully other
> people will have the logic to make decisions for themselves and give me
> help on python if they choose to do so.
>
> I hope my reply does not get censored. I am being reasonable here. And if
> you are wondering why I am "paranoid", you would be too if you are dealing
> with a server that might host a hot wallet. I dont want my server getting
> hacked just because I was too lazy to compile my own code. And it is not
> uncommon for binaries of open source projects to be injected with malware.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-06 Thread Souvik Dutta
This is not a place to quarrel our only task is to discuss and help other
learn and learn ourselves. To Mr. Marco what Mr. Lee says is correct. Since
he is working on a cryptocurrency project and he might use our original
code in his final project I don't think offering money is bad. After all
there have been times when a person demands his name to included in the
credits page. Our sole task is to help. And you cannot form opinions for
other people's by saying them not to support a person. That is injustice
and rude.

On Fri, 6 Mar, 2020, 9:14 pm Mr. Lee Chiffre, 
wrote:

> Thank you Marco for at least taking the time to read my message even if
> you do not agree with me on things. And no disrespect to you. But I came
> here for python related questions and help. Not to be called suspicious
> and untrustworthy only because I am concerned about security of users and
> for being a advocate of privacy. Then to call for me to be censored is
> just ludicrous.
>
>
> > People of Python List, I strongly discourage you to support this user.
> > He is quite suspicious for the following reasons:
> >
> > 1. he go so far as he offers money for, IMHO, a trivial task
>
> I said I am a python noob. This is why I asked for help. And I see no
> issue in offering payment for a programming task.
>
> > 2. he does not trust binaries from pip.
>
> What is the point of open source if you cannot compile from source code?
>
> > code. A lack of trust in open source projects that is quite unusual
> > 3. I don't trust any cryptocurrency.
>
> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.
>
> > I believe in privacy,  but not in financial privacy. Yes,
> > cryptocurrencies can be useful for circumvent bans from tyrannic
> > states. But they can, and _are_ used, primarily to:
> >  - wash dirty money, by criminals and mafias
> >  - evade taxes
> >  - buy highly unethical "products", like weapons... and who know what
> > other
> >  - finance tyrannies.
>
> Roads and cars are used by drug dealers. Stop using roads and cars. Cash
> is used by criminals. Stop using cash. Internet is used by child abusers.
> Stop supporting the internet. I am offended that you group me with
> criminals and baddies because I support technological privacy.
>
>
> >
> > I do _not_ think that all people that uses cryptocurrencies are
> > criminals. I had, for example, some co-workers that invested in
> > BitCoins, only for profit.
> >
> > But I do not trust this man, and I hope no one will offer support to
> > him. By my side, I'll report this discussion to moderators.
>
> That is fine if you dont like something. You dont have to help me out if
> you dont want to. But trying to censor me is unethical. Hopefully other
> people will have the logic to make decisions for themselves and give me
> help on python if they choose to do so.
>
> I hope my reply does not get censored. I am being reasonable here. And if
> you are wondering why I am "paranoid", you would be too if you are dealing
> with a server that might host a hot wallet. I dont want my server getting
> hacked just because I was too lazy to compile my own code. And it is not
> uncommon for binaries of open source projects to be injected with malware.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python question

2020-03-06 Thread Mr. Lee Chiffre
Thank you Marco for at least taking the time to read my message even if
you do not agree with me on things. And no disrespect to you. But I came
here for python related questions and help. Not to be called suspicious
and untrustworthy only because I am concerned about security of users and
for being a advocate of privacy. Then to call for me to be censored is
just ludicrous.


> People of Python List, I strongly discourage you to support this user.
> He is quite suspicious for the following reasons:
>
> 1. he go so far as he offers money for, IMHO, a trivial task

I said I am a python noob. This is why I asked for help. And I see no
issue in offering payment for a programming task.

> 2. he does not trust binaries from pip.

What is the point of open source if you cannot compile from source code?

> code. A lack of trust in open source projects that is quite unusual
> 3. I don't trust any cryptocurrency.

Not unusual. People use open source because they dont trust closed source.
Binaries that someone else compiled is not open source.

> I believe in privacy,  but not in financial privacy. Yes,
> cryptocurrencies can be useful for circumvent bans from tyrannic
> states. But they can, and _are_ used, primarily to:
>  - wash dirty money, by criminals and mafias
>  - evade taxes
>  - buy highly unethical "products", like weapons... and who know what
> other
>  - finance tyrannies.

Roads and cars are used by drug dealers. Stop using roads and cars. Cash
is used by criminals. Stop using cash. Internet is used by child abusers.
Stop supporting the internet. I am offended that you group me with
criminals and baddies because I support technological privacy.


>
> I do _not_ think that all people that uses cryptocurrencies are
> criminals. I had, for example, some co-workers that invested in
> BitCoins, only for profit.
>
> But I do not trust this man, and I hope no one will offer support to
> him. By my side, I'll report this discussion to moderators.

That is fine if you dont like something. You dont have to help me out if
you dont want to. But trying to censor me is unethical. Hopefully other
people will have the logic to make decisions for themselves and give me
help on python if they choose to do so.

I hope my reply does not get censored. I am being reasonable here. And if
you are wondering why I am "paranoid", you would be too if you are dealing
with a server that might host a hot wallet. I dont want my server getting
hacked just because I was too lazy to compile my own code. And it is not
uncommon for binaries of open source projects to be injected with malware.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-03 Thread Peter Otten
Jagga Soorma wrote:

> Thanks again Aldwin.  This seems to work, guess it is the set that is
> flipping the numbers:
> 
> x,y = (output.split())

The parens on the right are superfluous:

>>> a, b = "foo bar".split()
>>> a
'foo'
>>> b
'bar'

> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' '"
> output  = subprocess.check_output( inode_cmd,
> stderr=subprocess.STDOUT, shell=True )

You may also do the post-processing in Python, which allows you to avoid the 
shell completely:

>>> output = subprocess.check_output(["/bin/df", "--output=pcent,ipcent", 
"/var"])
>>> output
b'Use% IUse%\n 85%   16%\n'
>>> a, b = output.replace(b"%", b"").split()[-2:]
>>> a
b'85'
>>> b
b'16'

If you want integers:

>>> a, b = [int(v) for v in output.replace(b"%", b"").split()[-2:]]
>>> a
85
>>> b
16


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-02 Thread Jagga Soorma
Thanks again Aldwin.  This seems to work, guess it is the set that is
flipping the numbers:

x,y = (output.split())

Much appreciated!

On Wed, Oct 2, 2019 at 9:19 PM Aldwin Pollefeyt
 wrote:
>
> Seems to work also:
>
> >>> [x,y] = output.split()
>
> On Thu, Oct 3, 2019 at 12:17 PM Aldwin Pollefeyt  
> wrote:
>>
>> Oh, sorry .. please try this:
>>
>> >>> x,y = tuple(output.split())
>>
>> On Thu, Oct 3, 2019 at 12:11 PM Jagga Soorma  wrote:
>>>
>>> Thanks Aldwin that helps but it looks like it is reversing the numbers
>>> for some reason:
>>>
>>> the df command returns the following:
>>> 7  2
>>>
>>> I used your example and did:
>>> x,y = set(output.split())
>>>
>>> My assumption would be that x should be 7 and y should be 2.  However,
>>> when I print x and y it seems to be reversed (x is 2 and y is 7).  Am
>>> I missing something?
>>>
>>> Thanks
>>>
>>> On Wed, Oct 2, 2019 at 8:49 PM Aldwin Pollefeyt
>>>  wrote:
>>> >
>>> > You could use:
>>> >
>>> > >>> x, y = set(output.split())
>>> >
>>> > On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma  wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I am new to python and trying to do some basic things with python.  I
>>> >> am writing a script that runs a df command and I need parts of that
>>> >> output saved in 2 different variables.  Is this something that can be
>>> >> done?  I can do this by running multiple df commands but would prefer
>>> >> to make only one call:
>>> >>
>>> >> --
>>> >> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' 
>>> >> '"
>>> >> output  = subprocess.check_output( inode_cmd,
>>> >> stderr=subprocess.STDOUT, shell=True )
>>> >> --
>>> >>
>>> >> But this would end up giving me the following:
>>> >>
>>> >> #df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
>>> >>5   1
>>> >>
>>> >> I would like variable x to be 5 and variable y to be 1.  Is there a
>>> >> easier way to do this?
>>> >>
>>> >> Thanks in advance for your guidance.
>>> >> --
>>> >> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
Seems to work also:

>>> [x,y] = output.split()

On Thu, Oct 3, 2019 at 12:17 PM Aldwin Pollefeyt 
wrote:

> Oh, sorry .. please try this:
>
> >>> x,y = tuple(output.split())
>
> On Thu, Oct 3, 2019 at 12:11 PM Jagga Soorma  wrote:
>
>> Thanks Aldwin that helps but it looks like it is reversing the numbers
>> for some reason:
>>
>> the df command returns the following:
>> 7  2
>>
>> I used your example and did:
>> x,y = set(output.split())
>>
>> My assumption would be that x should be 7 and y should be 2.  However,
>> when I print x and y it seems to be reversed (x is 2 and y is 7).  Am
>> I missing something?
>>
>> Thanks
>>
>> On Wed, Oct 2, 2019 at 8:49 PM Aldwin Pollefeyt
>>  wrote:
>> >
>> > You could use:
>> >
>> > >>> x, y = set(output.split())
>> >
>> > On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma  wrote:
>> >>
>> >> Hello,
>> >>
>> >> I am new to python and trying to do some basic things with python.  I
>> >> am writing a script that runs a df command and I need parts of that
>> >> output saved in 2 different variables.  Is this something that can be
>> >> done?  I can do this by running multiple df commands but would prefer
>> >> to make only one call:
>> >>
>> >> --
>> >> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%'
>> ' '"
>> >> output  = subprocess.check_output( inode_cmd,
>> >> stderr=subprocess.STDOUT, shell=True )
>> >> --
>> >>
>> >> But this would end up giving me the following:
>> >>
>> >> #df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
>> >>5   1
>> >>
>> >> I would like variable x to be 5 and variable y to be 1.  Is there a
>> >> easier way to do this?
>> >>
>> >> Thanks in advance for your guidance.
>> >> --
>> >> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
Oh, sorry .. please try this:

>>> x,y = tuple(output.split())

On Thu, Oct 3, 2019 at 12:11 PM Jagga Soorma  wrote:

> Thanks Aldwin that helps but it looks like it is reversing the numbers
> for some reason:
>
> the df command returns the following:
> 7  2
>
> I used your example and did:
> x,y = set(output.split())
>
> My assumption would be that x should be 7 and y should be 2.  However,
> when I print x and y it seems to be reversed (x is 2 and y is 7).  Am
> I missing something?
>
> Thanks
>
> On Wed, Oct 2, 2019 at 8:49 PM Aldwin Pollefeyt
>  wrote:
> >
> > You could use:
> >
> > >>> x, y = set(output.split())
> >
> > On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma  wrote:
> >>
> >> Hello,
> >>
> >> I am new to python and trying to do some basic things with python.  I
> >> am writing a script that runs a df command and I need parts of that
> >> output saved in 2 different variables.  Is this something that can be
> >> done?  I can do this by running multiple df commands but would prefer
> >> to make only one call:
> >>
> >> --
> >> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' '
> '"
> >> output  = subprocess.check_output( inode_cmd,
> >> stderr=subprocess.STDOUT, shell=True )
> >> --
> >>
> >> But this would end up giving me the following:
> >>
> >> #df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
> >>5   1
> >>
> >> I would like variable x to be 5 and variable y to be 1.  Is there a
> >> easier way to do this?
> >>
> >> Thanks in advance for your guidance.
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-02 Thread Jagga Soorma
Thanks Aldwin that helps but it looks like it is reversing the numbers
for some reason:

the df command returns the following:
7  2

I used your example and did:
x,y = set(output.split())

My assumption would be that x should be 7 and y should be 2.  However,
when I print x and y it seems to be reversed (x is 2 and y is 7).  Am
I missing something?

Thanks

On Wed, Oct 2, 2019 at 8:49 PM Aldwin Pollefeyt
 wrote:
>
> You could use:
>
> >>> x, y = set(output.split())
>
> On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma  wrote:
>>
>> Hello,
>>
>> I am new to python and trying to do some basic things with python.  I
>> am writing a script that runs a df command and I need parts of that
>> output saved in 2 different variables.  Is this something that can be
>> done?  I can do this by running multiple df commands but would prefer
>> to make only one call:
>>
>> --
>> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' '"
>> output  = subprocess.check_output( inode_cmd,
>> stderr=subprocess.STDOUT, shell=True )
>> --
>>
>> But this would end up giving me the following:
>>
>> #df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
>>5   1
>>
>> I would like variable x to be 5 and variable y to be 1.  Is there a
>> easier way to do this?
>>
>> Thanks in advance for your guidance.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
You could use:

>>> x, y = set(output.split())

On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma  wrote:

> Hello,
>
> I am new to python and trying to do some basic things with python.  I
> am writing a script that runs a df command and I need parts of that
> output saved in 2 different variables.  Is this something that can be
> done?  I can do this by running multiple df commands but would prefer
> to make only one call:
>
> --
> inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' '"
> output  = subprocess.check_output( inode_cmd,
> stderr=subprocess.STDOUT, shell=True )
> --
>
> But this would end up giving me the following:
>
> #df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
>5   1
>
> I would like variable x to be 5 and variable y to be 1.  Is there a
> easier way to do this?
>
> Thanks in advance for your guidance.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Basic python question

2019-10-02 Thread Jagga Soorma
Hello,

I am new to python and trying to do some basic things with python.  I
am writing a script that runs a df command and I need parts of that
output saved in 2 different variables.  Is this something that can be
done?  I can do this by running multiple df commands but would prefer
to make only one call:

--
inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' '"
output  = subprocess.check_output( inode_cmd,
stderr=subprocess.STDOUT, shell=True )
--

But this would end up giving me the following:

#df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
   5   1

I would like variable x to be 5 and variable y to be 1.  Is there a
easier way to do this?

Thanks in advance for your guidance.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Not a python question, just programming logic trap?

2019-03-14 Thread jonas . thornvall
Den torsdag 14 mars 2019 kl. 06:09:02 UTC+1 skrev Rick Johnson:
> jonas.t...@gmail.com wrote:
> > Nah i can't see the error is due to the "If clause" branching possibly it 
> > should been an elseif at instead of separate if. No there is something 
> > going wrong with the variables.
> 
> Well, then you'd be wise to unpack those variables and inspect them.

I've done that there is nothing wrong with them the error comes when writing 
out to the canvas, and i rounded them so it is integer pixels. To be honest i 
think there maybe something with the canvas that goes wrong. A block of fixed 
length can't expand. I run console.logg()  barLength=xFrontStart-xBackEnd and 
it is constant at every call within if clause.  It is just that when canvas 
write out the values apparently the draw rectangle function somehow hold other 
values.

Well i restart the whole render programming, doing it right from start this 
time reading values from the record buffer and see if the animation problem 
magically dissapear. It could be something undefined affect the the variables.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Not a python question, just programming logic trap?

2019-03-13 Thread Ben Finney
jonas.thornv...@gmail.com writes:

> Anyone who is good at see logic traps in programming?
> comp.lang.javascript is defunct so i try here.

Please don't; this forum should primarily be used for discussing Python.

I appreciate that you have tried another forum for JavaScript, but
that's unrelated to whether this is an approriate forum for the
question. It isn't.

You could try https://stackoverflow.com/tags/javascript> but really
it's not good to be using this Python discussion forum for that purpose.

-- 
 \ “I went to a museum where all the artwork was done by children. |
  `\   They had all the paintings up on refrigerators.” —Steven Wright |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Not a python question, just programming logic trap?

2019-03-13 Thread jonas . thornvall
Anyone who is good at see logic traps in programming? comp.lang.javascript is 
defunct so i try here.

Using the metronome. 

https://midisequenser.000webhostapp.com 

I've tried to understand how following code can lead to that after the 
keyreleased the front of the keyed scrollbar raise/extend faster while the 
backend stay correct "in sync". One could think/imagine 
xFrontStart=scrollBarPos-FRONTOFFSET; somehow executed  more then once after 
release, but how could it, the keyrelease is true only in that part of code and 
only done once??? 

var FRONTOFFSET=0; 
var xKeylength=0; 
var xFrontStart=0; 
var xBackEnd=0; 
var keyreleased=false; 
function pianoSCROLL(){ 

 if(mess.data[0]==NOTE_ON && keyreleased==false){ 
xBackEnd=keylength; 
ctm.fillStyle = "magenta"; 

ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), 
xFrontStart, keyHeight); 
if(FRONTOFFSET==0) {FRONTOFFSET=scrollBarPos;} 
xFrontStart=scrollBarPos-FRONTOFFSET; 
 } else if(mess.data[0]==NOTE_OFF && keyreleased==false){ 
   console.log("keyreleased!"); 
   keyreleased=true; 
   xBarLength=Math.round(xFrontStart-xBackEnd); 
   ctm.fillStyle = "black"; 
   ctm.fillRect(keylength, 
(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); 
} 
if (keyreleased) { 
//console.log("timebar backend moving"); 
ctm.fillStyle = "black"; 
ctm.fillRect(keylength, 
(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); 
ctm.fillStyle = "orange"; 

ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)),xFrontStart,
 keyHeight); 
xFrontStart=scrollBarPos-FRONTOFFSET; 
xBackEnd=Math.round(xFrontStart-xBarLength); 
console.log("xBackEnd="+xBackEnd+" xBarLength="+xBarLength+" 
xFrontStart="+xFrontStart); 
} 
} 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-26 Thread Steve D'Aprano
On Sun, 26 Mar 2017 10:35 pm, Cameron Simpson wrote:

> On 26Mar2017 20:55, Steve D'Aprano  wrote:
>>On Sun, 26 Mar 2017 01:55 pm, c...@zip.com.au wrote:
>>> 1: He BCCed the list, not us individually. Look at the headers.
>>
>>BCCed addresses aren't visible in the headers. That's why they're BLIND
>>CC.
> 
> Of course, but the received headers etc show it passed though the list.

Sending to the list is not a bad thing. We know the OP sent to the list,
because his post appeared on the list :-)

The question is whether he BCCed a bunch of regulars or not.

[...]
> If the headers say it went though the list, _that_ copy went through the
> list, _not_ to your personal address (well, not from him; of course the
> list delivered it to you).

Unfortunately I deleted the email so I can't look at the headers, but
nevertheless I can categorically say that it didn't come from the mailing
list, because the python-list@python.org mailing list doesn't have my
address. I've always read this though the newsgroup.

I do still have the relevant mail logs:

Mar 25 03:08:36 ando postfix/smtpd[24188]: connect from
  mail-wr0-f194.google.com[209.85.128.194]
Mar 25 03:08:37 ando postfix/smtpd[24188]: 2093D1204E2:
  client=mail-wr0-f194.google.com[209.85.128.194]
Mar 25 03:08:37 ando postfix/cleanup[24192]: 2093D1204E2:
  message-id=
Mar 25 03:08:37 ando postfix/qmgr[3004]: 2093D1204E2:
  from=, size=3258, nrcpt=1 (queue active)
Mar 25 03:08:38 ando postfix/smtpd[24188]: disconnect from
  mail-wr0-f194.google.com[209.85.128.194]

I'm not an expert, but to me that looks pretty convincing that the email
came directly from Google, not from the mailing list. Am I wrong?


>>Your interpretation doesn't explain why I received a copy sent to my
>>personal email address. I read this via the newsgroup comp.lang.python,
>>not the mailing list, and I'm not subscribed to the email mailing list. If
>>the OP had merely BCCed the mailing list, I wouldn't have received a copy
>>in my personal inbox.
> 
> Fair point. Though I thought I only got one copy, might be wrong.

Maybe you weren't one of the people he BCCed :-)





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-26 Thread Cameron Simpson

On 26Mar2017 20:55, Steve D'Aprano  wrote:

On Sun, 26 Mar 2017 01:55 pm, c...@zip.com.au wrote:

1: He BCCed the list, not us individually. Look at the headers.


BCCed addresses aren't visible in the headers. That's why they're BLIND CC.


Of course, but the received headers etc show it passed though the list.


The lack of personal email addresses in the headers doesn't prove they
weren't there. All the headers tell us is that he definitely posted to the
list. (But we knew that!)


If the headers say it went though the list, _that_ copy went through the list, 
_not_ to your personal address (well, not from him; of course the list 
delivered it to you).



Your interpretation doesn't explain why I received a copy sent to my
personal email address. I read this via the newsgroup comp.lang.python, not
the mailing list, and I'm not subscribed to the email mailing list. If the
OP had merely BCCed the mailing list, I wouldn't have received a copy in my
personal inbox.


Fair point. Though I thought I only got one copy, might be wrong.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-26 Thread Steve D'Aprano
On Sun, 26 Mar 2017 01:55 pm, c...@zip.com.au wrote:

> 1: He BCCed the list, not us individually. Look at the headers.

BCCed addresses aren't visible in the headers. That's why they're BLIND CC.
The lack of personal email addresses in the headers doesn't prove they
weren't there. All the headers tell us is that he definitely posted to the
list. (But we knew that!)

Your interpretation doesn't explain why I received a copy sent to my
personal email address. I read this via the newsgroup comp.lang.python, not
the mailing list, and I'm not subscribed to the email mailing list. If the
OP had merely BCCed the mailing list, I wouldn't have received a copy in my
personal inbox.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread cs

On 26Mar2017 00:11, Erik  wrote:

On 25/03/17 20:26, MRAB wrote:

On 2017-03-25 20:10, Terry Reedy wrote:

On 3/25/2017 6:50 AM, Steve D'Aprano wrote:

they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he
did a
mass BCC of many regulars here, which makes this spam.

I got the BCC also and was puzzled why.

Same here.

Me too, and I'm hardly a prolific poster compared to some of you lot.


Guys guys guys,

1: He BCCed the list, not us individually. Look at the headers.

2: I got a perfectly civil and informative response from him.

So treat him as up front!

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread Abdul Abdul
Hi Cameron,

Thanks for your kind reply and suggestion. Sure, please find my question
below. I also show the different edits made and what errors emerged after
those edits. Thanks for your support!

I have the following code portion for a convolutional neural network:

import numpy as np
import matplotlib.pyplot as plt
import cifar_tools
import tensorflow as tf

data, labels = cifar_tools.read_data('C:\\Users\\abc\\Desktop\\temp')

x = tf.placeholder(tf.float32, [None, 150 * 150])
y = tf.placeholder(tf.float32, [None, 2])

w1 = tf.Variable(tf.random_normal([5, 5, 1, 64]))
b1 = tf.Variable(tf.random_normal([64]))

w2 = tf.Variable(tf.random_normal([5, 5, 64, 64]))
b2 = tf.Variable(tf.random_normal([64]))

w3 = tf.Variable(tf.random_normal([6*6*64, 1024]))
b3 = tf.Variable(tf.random_normal([1024]))

w_out = tf.Variable(tf.random_normal([1024, 2]))
b_out = tf.Variable(tf.random_normal([2]))

def conv_layer(x,w,b):
conv = tf.nn.conv2d(x,w,strides=[1,1,1,1], padding = 'SAME')
conv_with_b = tf.nn.bias_add(conv,b)
conv_out = tf.nn.relu(conv_with_b)
return conv_out

def maxpool_layer(conv,k=2):
return tf.nn.max_pool(conv, ksize=[1,k,k,1], strides=[1,k,k,1],
padding='SAME')

def model():
x_reshaped = tf.reshape(x, shape=[-1,150,150,1])

conv_out1 = conv_layer(x_reshaped, w1, b1)
maxpool_out1 = maxpool_layer(conv_out1)
norm1 = tf.nn.lrn(maxpool_out1, 4, bias=1.0, alpha=0.001/9.0, beta=0.75)

conv_out2 = conv_layer(norm1, w2, b2)
maxpool_out2 = maxpool_layer(conv_out2)
norm2 = tf.nn.lrn(maxpool_out2, 4, bias=1.0, alpha=0.001/9.0, beta=0.75)

maxpool_reshaped = tf.reshape(maxpool_out2,
[-1,w3.get_shape().as_list()[0]])
local = tf.add(tf.matmul(maxpool_reshaped, w3), b3)
local_out = tf.nn.relu(local)

out = tf.add(tf.matmul(local_out, w_out), b_out)
return out

model_op = model()

cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(model_op,
y))
train_op = tf.train.AdamOptimizer(learning_rate=0.001).minimize(cost)

correct_pred = tf.equal(tf.argmax(model_op, 1), tf.argmax(y,1))
accuracy = tf.reduce_mean(tf.cast(correct_pred,tf.float32))

I'm reading `150x150` grayscale images, but couldn't understand the
following error I'm having:

EPOCH 0
Traceback (most recent call last):
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
1021, in _do_call
return fn(*args)
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
1003, in _run_fn
status, run_metadata)
  File "C:\Python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
  File
"C:\Python35\lib\site-packages\tensorflow\python\framework\errors_impl.py",
line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to
reshape is a tensor with 92416 values, but the requested shape requires a
multiple of 2304
 [[Node: Reshape_1 = Reshape[T=DT_FLOAT, Tshape=DT_INT32,
_device="/job:localhost/replica:0/task:0/cpu:0"](MaxPool_1,
Reshape_1/shape)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "cnn.py", line 70, in 
_, accuracy_val = sess.run([train_op, accuracy], feed_dict={x:
batch_data, y: batch_onehot_vals})
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
766, in run
run_metadata_ptr)
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
964, in _run
feed_dict_string, options, run_metadata)
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
1014, in _do_run
target_list, options, run_metadata)
  File
"C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line
1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to
reshape is a tensor with 92416 values, but the requested shape requires a
multiple of 2304
 [[Node: Reshape_1 = Reshape[T=DT_FLOAT, Tshape=DT_INT32,
_device="/job:localhost/replica:0/task:0/cpu:0"](MaxPool_1,
Reshape_1/shape)]]

Caused by op 'Reshape_1', defined at:
  File "cnn.py", line 50, in 
model_op = model()
  File "cnn.py", line 43, in model
maxpool_reshaped = tf.reshape(maxpool_out2,
[-1,w3.get_shape().as_list()[0]])
  File
"C:\Python35\lib\site-packages\tensorflow\python\ops\gen_array_ops.py",
line 2448, in reshape
name=name)
  File
"C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py",
line 759, in apply_op
op_def=op_def)
  File
"C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line
2240, in create_op
original_op=self._default_original_op, 

Re: Python question

2017-03-25 Thread Erik

On 25/03/17 20:26, MRAB wrote:

On 2017-03-25 20:10, Terry Reedy wrote:

On 3/25/2017 6:50 AM, Steve D'Aprano wrote:

they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he
did a
mass BCC of many regulars here, which makes this spam.


I got the BCC also and was puzzled why.


Same here.


Me too, and I'm hardly a prolific poster compared to some of you lot.

E.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread MRAB

On 2017-03-25 20:10, Terry Reedy wrote:

On 3/25/2017 6:50 AM, Steve D'Aprano wrote:

On Sat, 25 Mar 2017 10:09 am, Cameron Simpson wrote:


On 24Mar2017 18:08, Abdul Abdul  wrote:

I hope you are doing fine. I have added a question on StackOverflow and
thought you might have an idea on it. This is the question



Hi Adbul,

Please just post the question here, with a nice descriptive Subject: line.

It is quite possible for people to be reading this list when they do not
have web access (eg offline on a train, as I sometimes do) and it is
anyway annoying to have to open a web browser to see what you are asking
about, and doubly annoying to copy from that question into the list for
replies.



I solve that problem by hitting Delete on the original post, ESPECIALLY if
they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he did a
mass BCC of many regulars here, which makes this spam.


I got the BCC also and was puzzled why.


Same here.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread Terry Reedy

On 3/25/2017 6:50 AM, Steve D'Aprano wrote:

On Sat, 25 Mar 2017 10:09 am, Cameron Simpson wrote:


On 24Mar2017 18:08, Abdul Abdul  wrote:

I hope you are doing fine. I have added a question on StackOverflow and
thought you might have an idea on it. This is the question



Hi Adbul,

Please just post the question here, with a nice descriptive Subject: line.

It is quite possible for people to be reading this list when they do not
have web access (eg offline on a train, as I sometimes do) and it is
anyway annoying to have to open a web browser to see what you are asking
about, and doubly annoying to copy from that question into the list for
replies.



I solve that problem by hitting Delete on the original post, ESPECIALLY if
they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he did a
mass BCC of many regulars here, which makes this spam.


I got the BCC also and was puzzled why.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread Steve D'Aprano
On Sat, 25 Mar 2017 10:09 am, Cameron Simpson wrote:

> On 24Mar2017 18:08, Abdul Abdul  wrote:
>>I hope you are doing fine. I have added a question on StackOverflow and
>>thought you might have an idea on it. This is the question
>>
> 
> Hi Adbul,
> 
> Please just post the question here, with a nice descriptive Subject: line.
> 
> It is quite possible for people to be reading this list when they do not
> have web access (eg offline on a train, as I sometimes do) and it is
> anyway annoying to have to open a web browser to see what you are asking
> about, and doubly annoying to copy from that question into the list for
> replies.


I solve that problem by hitting Delete on the original post, ESPECIALLY if
they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he did a
mass BCC of many regulars here, which makes this spam.

Judging from the question on Stackoverflow, I think he's just trying to
drive eyeballs to the question so he can get higher reputation. It is a
silly question: he says he has a pickle file containing an image file, and
he's asking (1) what's in the pickle file, and (2) how can he create an
identical pickle file containing a different image.

The answer to (1) is "Whatever you put in it".

Or possibly malware: he links to an actual pickle file he has put up on-line
somewhere. Anyone brave enough to unpickle it in a sandbox and report on
whether it contains what he says it contains? Remember that pickles can
contain arbitrary executable code.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-25 Thread dieter
Abdul Abdul  writes:
> I hope you are doing fine. I have added a question on StackOverflow and
> thought you might have an idea on it. This is the question
> 

I do not want to go into the details of your concrete problem --
just give some general remarks about "pickle".

"pickle" is used for serialization/deserialization of (most) Python objects:
i.e. it can transform a Python object into a string (called a "pickle")
and (later) reconstruct the object from the pickle.

You should not be interested in the internal pickle structure --
keep at the Python level.


For your concrete problem: unpickle your pickle file to get
a Python object; construct a similar Python object with the new data;
pickle that Python object.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-24 Thread Cameron Simpson

On 24Mar2017 18:08, Abdul Abdul  wrote:

I hope you are doing fine. I have added a question on StackOverflow and
thought you might have an idea on it. This is the question



Hi Adbul,

Please just post the question here, with a nice descriptive Subject: line.

It is quite possible for people to be reading this list when they do not have 
web access (eg offline on a train, as I sometimes do) and it is anyway annoying 
to have to open a web browser to see what you are asking about, and doubly 
annoying to copy from that question into the list for replies.


Thank you,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Python question

2017-03-24 Thread Abdul Abdul
Hello,

I hope you are doing fine. I have added a question on StackOverflow and
thought you might have an idea on it. This is the question

.

Thanks a lot for your kind support.

Best,
Abder
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Another python question

2016-03-19 Thread sohcahtoa82
On Friday, March 18, 2016 at 3:46:44 PM UTC-7, Alan Gabriel wrote:
> Sorry for the multiple questions but my while loop is not working as intended.
> 
> Here is the code :
> n = 1
> list1 = []
> count = 0  #amount of times program repeats
> steps = 0 # amount of steps to reach 1
> step_list = []
> while n!=0:
> n= int(input())
> list1.append(n)
> length = len(list1)
> 
> while count < length:
> num= list1[count]
> while num!= 1:
> if num%2 == 0:
> num= int(num/2)
> print(num)
> steps+=1
> if num%2 == 1:
> num=int(3*num+1)
> print(num)
> steps+=1
> 
> count+=1
> step_list.append(steps)
> steps=0
> 
> This code is meant to get numbers from the user in different lines and 
> convert into a list. When this is done the first while loop  runs until it 
> checks all the numbers in the list. The 2nd while loop is meant to stop when 
> the number is equal to 1 however the 2nd while loop keeps running.
> 
> Sorry for the bad naming but I was in a rush, ty anyway

I'll give you a big hint.  Your problem is on this line:

if num%2 == 1:

Step through your program slowly.  What happens when num == 2?
-- 
https://mail.python.org/mailman/listinfo/python-list


Another python question

2016-03-18 Thread Alan Gabriel
Sorry for the multiple questions but my while loop is not working as intended.

Here is the code :
n = 1
list1 = []
count = 0  #amount of times program repeats
steps = 0 # amount of steps to reach 1
step_list = []
while n!=0:
n= int(input())
list1.append(n)
length = len(list1)

while count < length:
num= list1[count]
while num!= 1:
if num%2 == 0:
num= int(num/2)
print(num)
steps+=1
if num%2 == 1:
num=int(3*num+1)
print(num)
steps+=1

count+=1
step_list.append(steps)
steps=0

This code is meant to get numbers from the user in different lines and convert 
into a list. When this is done the first while loop  runs until it checks all 
the numbers in the list. The 2nd while loop is meant to stop when the number is 
equal to 1 however the 2nd while loop keeps running.

Sorry for the bad naming but I was in a rush, ty anyway



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PYTHON QUESTION

2015-06-14 Thread Laurent Pointal
adebayo.abra...@gmail.com wrote his student exercise as raw text:

 Help with this problem!
 
 Temperature converter
 Description
 
 Write two functions that will convert temperatures back and forth from the
 Celsius and Fahrenheit temperature scales. The formulas for making the
 conversion are as follows:
 
   Tc=(5/9)*(Tf-32)
   Tf=(9/5)*Tc+32
 
 where Tc is the Celsius temperature and Tf is the Fahrenheit temperature.
 More information and further descriptions of how to do the conversion can
 be found at this NASA Webpage. If you finish this assignment quickly, add
 a function to calculate the wind chill. Input
 
 Your program should ask the user to input a temperature and then which
 conversion they would like to perform.

One link to help you: http://www.catb.org/esr/faqs/smart-questions.html

You have just to add the Python syntax for functions declaration and return 
value around your expressions (writing let as an exercise)… just care of a 
small difference between Python2 et Python3 with the division operator, 
which may makes you discover a tricky issue with integers manipulation 
(common to many programming languages).

A+

-- 
https://mail.python.org/mailman/listinfo/python-list


PYTHON QUESTION

2015-06-11 Thread adebayo . abraham
Help with this problem!

Temperature converter
Description

Write two functions that will convert temperatures back and forth from the 
Celsius and Fahrenheit temperature scales. The formulas for making the 
conversion are as follows:

  Tc=(5/9)*(Tf-32)
  Tf=(9/5)*Tc+32

where Tc is the Celsius temperature and Tf is the Fahrenheit temperature. More 
information and further descriptions of how to do the conversion can be found 
at this NASA Webpage. If you finish this assignment quickly, add a function to 
calculate the wind chill.
Input

Your program should ask the user to input a temperature and then which 
conversion they would like to perform.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PYTHON QUESTION

2015-06-11 Thread David Palao
2015-06-11 12:44 GMT+02:00  adebayo.abra...@gmail.com:
 Help with this problem!

 Temperature converter
 Description

 Write two functions that will convert temperatures back and forth from the 
 Celsius and Fahrenheit temperature scales. The formulas for making the 
 conversion are as follows:

   Tc=(5/9)*(Tf-32)
   Tf=(9/5)*Tc+32

 where Tc is the Celsius temperature and Tf is the Fahrenheit temperature. 
 More information and further descriptions of how to do the conversion can be 
 found at this NASA Webpage. If you finish this assignment quickly, add a 
 function to calculate the wind chill.
 Input

 Your program should ask the user to input a temperature and then which 
 conversion they would like to perform.
 --
 https://mail.python.org/mailman/listinfo/python-list

Hello,
While people here is kindly helping others, it doesn't work the way
you are posing it: we will not do your homeworks.
If you want some help, please, present some code that you wrote and
does not work, or a specific question about the problem. For instance,
how can I write a function in python?
BTW, probably your questions should go to the tutor mailing list...

Best
-- 
https://mail.python.org/mailman/listinfo/python-list


Simple Python question for some

2012-10-28 Thread Mark L. Hotz
I have what I think should be a relatively simple question for someone who
is knowledgeable about Python.

 

At the IDLE prompt, when I enter b  99, it responds True. In fact, it
doesn't matter which number is entered here, b is always greater (e.g. b
 1 == True; b  10 == True, or b  99 = False).

 

Why is this true?  If I use ord(b) it returns 98, so Python cannot be
using the ASCII or Unicode value when interpreting b  99.  When I sort a
mixed list using Python, and the list contains b among a series of numeric
values, b is always sorted as last, indicating that it has a value greater
than the highest number?

 

How do I prove that b is greater than any number?  Or is it something very
simple, and Python simply orders characters after numbers, or perhaps Python
only interprets numbers like 99 as a 9 (i.e. ord(9) == 57)?

 

Thank you.

 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple Python question for some

2012-10-28 Thread Mark Lawrence

On 28/10/2012 23:51, Mark L. Hotz wrote:

I have what I think should be a relatively simple question for someone who
is knowledgeable about Python.


Sorry you've come to the wrong place :)



At the IDLE prompt, when I enter b  99, it responds True. In fact, it
doesn't matter which number is entered here, b is always greater (e.g. b

1 == True; b  10 == True, or b  99 = False).


Why is this true?  If I use ord(b) it returns 98, so Python cannot be
using the ASCII or Unicode value when interpreting b  99.  When I sort a
mixed list using Python, and the list contains b among a series of numeric
values, b is always sorted as last, indicating that it has a value greater
than the highest number?

How do I prove that b is greater than any number?  Or is it something very
simple, and Python simply orders characters after numbers, or perhaps Python
only interprets numbers like 99 as a 9 (i.e. ord(9) == 57)?

Thank you.



The behaviour of Python between version 2 and 3 has been changed hence.

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit 
(Intel)] on win32

Type help, copyright, credits or license for more information.
 'b'  99
True

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 
bit (Intel)] on win32

Type help, copyright, credits or license for more information.
 'b'  99
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unorderable types: str()  int()

--
Cheers.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Simple Python question for some

2012-10-28 Thread Chris Rebert
On Sun, Oct 28, 2012 at 4:51 PM, Mark L. Hotz mlh...@gmail.com wrote:
 I have what I think should be a relatively simple question for someone who
 is knowledgeable about Python.

 At the IDLE prompt, when I enter “b”  99, it responds True. In fact, it
 doesn’t matter which number is entered here, “b” is always greater (e.g. “b”
 1 == True; “b”  10 == True, or “b”  99 = False).

 Why is this true?

Per http://docs.python.org/2/library/stdtypes.html#comparisons :
Objects of different types, except different numeric types and
different string types, […] are ordered consistently but arbitrarily
(so that sorting a heterogeneous array yields a consistent result).
Note that the except part just means that, e.g. floats and ints can
be compared with each other, and Unicode and byte strings can be
compared with each other. It does NOT mean that numbers and strings
can be meaningfully compared with each other.

This is fixed in Python 3, where such nonsensical comparisons will
instead raise TypeError.

  If I use ord(“b”) it returns 98, so Python cannot be
 using the ASCII or Unicode value when interpreting “b”  99.

It has nothing to do with implicit casting between strings and numbers
(which, as a general rule, Python does not do).

From the same linked section as before:
CPython implementation detail: Objects of [incompatible types] are
ordered by their type names

So ints come before strs because int comes before str lexicographically.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple Python question for some

2012-10-28 Thread Chris Angelico
On Mon, Oct 29, 2012 at 10:51 AM, Mark L. Hotz mlh...@gmail.com wrote:
 At the IDLE prompt, when I enter “b”  99, it responds True. In fact, it
 doesn’t matter which number is entered here, “b” is always greater (e.g. “b”
 1 == True; “b”  10 == True, or “b”  99 = False).

To Python, different object types are completely different.
Incidentally, with issues like this, it's worth mentioning which
version of Python you're using - though in this case, it's clear
you're using Python 2. As of version 3, behaviour is different:

Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit
(Intel)] on win32
Type copyright, credits or license() for more information.
 b  99
Traceback (most recent call last):
  File pyshell#1, line 1, in module
b  99
TypeError: unorderable types: str()  int()


As of Python 2, there's a slightly esoteric rule as described here:
http://docs.python.org/2/library/stdtypes.html#comparisons
CPython implementation detail: Objects of different types except
numbers are ordered by their type names; objects of the same types
that don’t support proper comparison are ordered by their address.

So since str is greater than int, b is greater than 99.

Fortunately, Python does NOT have arcane rules for comparing numbers
as though they were strings. Notably:

 100 == 100
False

Which means that strings will ALWAYS be compared as strings, and
numbers will ALWAYS be compared as numbers, and ne'er the twain shall
conflict. I can trust Python to compare MD5 hashes reliably:

 912128034267498495410681495015e0 != 00912128034267498495410681495015
True

Of course, I'm not pointing fingers at any other languages here, but
this is a known security hole in one rather widely-used one.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Simple Python question for some

2012-10-28 Thread Evan Driscoll
On 10/28/2012 7:18 PM, Chris Rebert wrote:
 This is fixed in Python 3, where such nonsensical comparisons will
 instead raise TypeError.

It's worth pointing out that at least one kind of inequality comparison
which some people (e.g. me) would consider nonsensical is still allowed
in Python 3, which is between Boolean values and numbers:

   True  1
  False
   False  1
  True

which is probably because

   True == 1
  True
   False == 0
  True

Many people (probably most people, to be honest) disagree with me that
this is wrong, but regardless of whether you like it or not you need to
know what happens in such cases.


On 10/28/2012 7:18 PM, Chris Angelico wrote:
 Which means that strings will ALWAYS be compared as strings, and
 numbers will ALWAYS be compared as numbers, and ne'er the twain shall
 conflict. I can trust Python to compare MD5 hashes reliably:
 
 912128034267498495410681495015e0 !=00912128034267498495410681495015
 True
 
 Of course, I'm not pointing fingers at any other languages here, but
 this is a known security hole in one rather widely-used one.

If you are PerHaPs talking about the language I think you are, my
favorite fact about that is I'm that I think a while back I saw a bug
entry about something like that and they weren't sure how or even if it
should be fixed.

Evan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Simple Python question for some

2012-10-28 Thread Chris Angelico
On Mon, Oct 29, 2012 at 3:30 PM, Evan Driscoll drisc...@cs.wisc.edu wrote:
 On 10/28/2012 7:18 PM, Chris Angelico wrote:
 Which means that strings will ALWAYS be compared as strings, and
 numbers will ALWAYS be compared as numbers, and ne'er the twain shall
 conflict. I can trust Python to compare MD5 hashes reliably:

 912128034267498495410681495015e0 !=00912128034267498495410681495015
 True

 Of course, I'm not pointing fingers at any other languages here, but
 this is a known security hole in one rather widely-used one.

 If you are PerHaPs talking about the language I think you are, my
 favorite fact about that is I'm that I think a while back I saw a bug
 entry about something like that and they weren't sure how or even if it
 should be fixed.

Indeed. So it's an issue unlikely to go away any time soon.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


new to python question

2011-09-28 Thread The Geek
I'm clearly not understanding something about scope in python...  Any help
is appreciated

In the following script I'm attempting to create 2 Foo objects, for each Foo
object I create 2 Bars and add them to Foo's bar array

Something hokey is occurring with the foo.bars.append(bar) line such that
Foo.bars is treated as a static (I know python doesn't have statics)

I have a workaround using encapsulation for the bars array but I prefer
would also like to understand the issue.

TIA,
Brad

[SCRIPT]
foos = []

class Foo:
id = 0
bars = []

class Bar:
id = 0

for j in range(0, 2):
foo = Foo()

for i in range(0, 2):
bar = Bar()
bar.id = i
foo.bars.append(bar)
foos.append(foo)

for myFoo in foos:
print(foo id: , myFoo.id)
for myBar in myFoo.bars:
print (\tbar id: , myBar.id)

[/SCRIPT]

[OUTPUT]
python test.py
foo id:  0
bar id:  0
bar id:  1
bar id:  0
bar id:  1
foo id:  0
bar id:  0
bar id:  1
bar id:  0
bar id:  1
[/OUTPUT]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: new to python question

2011-09-28 Thread Benjamin Kaplan
On Wed, Sep 28, 2011 at 5:06 PM, The Geek theg...@gmail.com wrote:
 I'm clearly not understanding something about scope in python...  Any help
 is appreciated
 In the following script I'm attempting to create 2 Foo objects, for each Foo
 object I create 2 Bars and add them to Foo's bar array
 Something hokey is occurring with the foo.bars.append(bar) line such that
 Foo.bars is treated as a static (I know python doesn't have statics)
 I have a workaround using encapsulation for the bars array but I prefer
 would also like to understand the issue.
 TIA,
 Brad
 [SCRIPT]
 foos = []
 class Foo:
 id = 0
 bars = []
 class Bar:
 id = 0
 for j in range(0, 2):
 foo = Foo()
 for i in range(0, 2):
 bar = Bar()
 bar.id = i
 foo.bars.append(bar)
 foos.append(foo)
 for myFoo in foos:
 print(foo id: , myFoo.id)
 for myBar in myFoo.bars:
 print (\tbar id: , myBar.id)
 [/SCRIPT]


It's a pretty common gotcha for people coming from other languages.
Everything declared in the class scope becomes an attribute of the
class.
 class Foo(object) :
...a = 3
...def b() : pass
...
 dir(Foo)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribut
e__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_e
x__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_
_weakref__', 'a', 'b']

Mutating those objects mutates the attribute of the class, which is
visible to all instances of the class.

In order to get an instance of a class, you have to add the field to
the instance of the class instead of to the class itself.

class Bar(object) :
def ___init__(self) :
self.a = 3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-08 Thread Piet van Oostrum
Terry Reedy tjre...@udel.edu writes:

 Indexing objects by their internal id is usually useless. 

obj.id is not the internal id. 
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list


Need help with simple OOP Python question

2011-09-05 Thread Kristofer Tengström
Hi, I'm having trouble creating objects that in turn can have custom
objects as variables. The code looks like this:

-

class A:
sub = dict()
def sub_add(self, cls):
obj = cls()
self.sub[obj.id] = obj

class B(A):
id = 'inst'

base = A()
base.sub_add(B)
base.sub['inst'].sub_add(B)

print # prints a blank line
print base.sub['inst']
print base.sub['inst'].sub['inst']

--

Now, what I get from this is the following:
__main__.B instance at 0x01FC20A8
__main__.B instance at 0x01FC20A8
Why is this? What I want is for them to be two separate objects, but
it seems like they are the same one. I've tried very hard to get this
to work, but as I've been unsuccessful I would really appreciate some
comments on this. I'm sure it's something really easy that I just
haven't thought of.

Python version is 2.6.5 (I'm using Panda3D to create a 2½D game).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Stephen Hansen
On 9/4/11 11:47 PM, Kristofer Tengström wrote:
 Hi, I'm having trouble creating objects that in turn can have custom
 objects as variables. The code looks like this:
 
 -
 
 class A:
 sub = dict()

You are sharing this single sub dictionary with all instances of your
A class.

If you want to define instance-specific attributes, define them in the
__init__ method, like so:

class A:
def __init__(self):
self.sub = dict()

def sub_add(self, cls):
obj = cls()
self.sub[obj.id] = obj

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Peter Otten
Kristofer Tengström wrote:

 Hi, I'm having trouble creating objects that in turn can have custom
 objects as variables. The code looks like this:
 
 -
 
 class A:
 sub = dict()

Putting it into the class like this means sub is shared by all instances.

 def sub_add(self, cls):
 obj = cls()
 self.sub[obj.id] = obj
 
 class B(A):
 id = 'inst'
 
 base = A()
 base.sub_add(B)
 base.sub['inst'].sub_add(B)
 
 print # prints a blank line
 print base.sub['inst']
 print base.sub['inst'].sub['inst']
 
 --
 
 Now, what I get from this is the following:
 __main__.B instance at 0x01FC20A8
 __main__.B instance at 0x01FC20A8
 Why is this? What I want is for them to be two separate objects, but
 it seems like they are the same one. I've tried very hard to get this
 to work, but as I've been unsuccessful I would really appreciate some
 comments on this. I'm sure it's something really easy that I just
 haven't thought of.

Your class A needs an initialiser:

class A:
def __init__(self):
self.sub = {} # one dict per instance
# ...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Ben Finney
Kristofer Tengström krille...@gmail.com writes:

 Hi, I'm having trouble creating objects that in turn can have custom
 objects as variables.

That terminology is rather confused.

I think what you want is to have instances with their own attributes.

 class A:
 sub = dict()

This binds a single object (a new empty dict) to the class attribute
‘sub’. Every instance of class ‘A’ will share the same attribute, and
hence that same dict.

 def sub_add(self, cls):

This defines a function which will be bound to the class attribute
‘sub_add’. It will, when later called as a method, receive the instance
as the first parameter, bound to the local name ‘self’.

 obj = cls()
 self.sub[obj.id] = obj

Here, ‘self’ will be an instance of the ‘A’ class. Each instance has no
‘sub’ attribute, so Python will find the class attribute ‘A.sub’, shared
by all ‘A’ instances. You're then modifying that class attribute ‘A.sub’.

[…]

 Now, what I get from this is the following:
 __main__.B instance at 0x01FC20A8
 __main__.B instance at 0x01FC20A8
 Why is this?

I hope the above explains it.

 What I want is for them to be two separate objects, but it seems like
 they are the same one.

Yes. Anything you talk about in the class definition scope cannot know
about any instance of that class, since the instances don't exist yet.

Instead, instance attributes need to be bound to a particular instance,
which means you need to have a reference to the instance; that's what
‘self’ is for. The class initialiser is a method named ‘__init__’, and
is called on each newly-created instance before that instance is
returned from the constructor.

I advise you to work through the Python tutorial, beginning to end,
which will give you a good grounding in these and other fundamental
Python topics URL:http://docs.python.org/tutorial/. Work through each
example, understand it by experimenting, and then proceed to the next,
until you've done the lot.

-- 
 \ “If history and science have taught us anything, it is that |
  `\ passion and desire are not the same as truth.” —E. O. Wilson, |
_o__)  _Consilience_, 1998 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread srinivas hn
Hi,
You are getting same object because you are overriding the dictionary
update.
Its printing the proper value with the last updated instance of B.

If you want to see the two different instances of class B give print
self.sub inside the sub_add method in class A.

CHEERS
CNA
9986229891


On Mon, Sep 5, 2011 at 12:17 PM, Kristofer Tengström krille...@gmail.comwrote:

 Hi, I'm having trouble creating objects that in turn can have custom
 objects as variables. The code looks like this:

 -

 class A:
sub = dict()
def sub_add(self, cls):
obj = cls()
self.sub[obj.id] = obj

 class B(A):
id = 'inst'

 base = A()
 base.sub_add(B)
 base.sub['inst'].sub_add(B)

 print # prints a blank line
 print base.sub['inst']
 print base.sub['inst'].sub['inst']

 --

 Now, what I get from this is the following:
 __main__.B instance at 0x01FC20A8
 __main__.B instance at 0x01FC20A8
 Why is this? What I want is for them to be two separate objects, but
 it seems like they are the same one. I've tried very hard to get this
 to work, but as I've been unsuccessful I would really appreciate some
 comments on this. I'm sure it's something really easy that I just
 haven't thought of.

 Python version is 2.6.5 (I'm using Panda3D to create a 2½D game).
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Peter Otten
Kristofer Tengström wrote:

 Thanks everyone, moving the declaration to the class's __init__ method
 did the trick. Now there's just one little problem left. I'm trying to
 create a list that holds the parents for each instance in the
 hierarchy. This is what my code looks like now:
 
 -
 
 class A:
 def __init__(self, parents=None):
 self.sub = dict()
 if parents:

You should explicitly test for None here; otherwise in a call like

ancestors = []
a = A(anchestors)

the list passed as an argument will not be used, which makes fore confusing 
behaviour.

 self.parents = parents
 else:
 self.parents = []
 def sub_add(self, cls):
 hierarchy = self.parents
 hierarchy.append(self)

Here you are adding self to the parents (that should be called ancestors) 
and pass it on to cls(...). Then -- because it's non-empty -- it will be 
used by the child, too, and you end up with a single parents list.

 obj = cls(hierarchy)
 self.sub[obj.id] = obj

While the minimal fix is to pass a copy

def sub_add(self, cls):
obj = cls(self.parents + [self])
self.sub[obj.id] = obj

I suggest that you modify your node class to keep track only of the direct 
parent instead of all ancestors. That makes the implementation more robust 
when you move a node to another parent.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Kristofer Tengström
Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like now:

-

class A:
def __init__(self, parents=None):
self.sub = dict()
if parents:
self.parents = parents
else:
self.parents = []
def sub_add(self, cls):
hierarchy = self.parents
hierarchy.append(self)
obj = cls(hierarchy)
self.sub[obj.id] = obj

class B(A):
id = 'inst'

base = A()
base.sub_add(B)
base.sub['inst'].sub_add(B)

print
print vars(base)
print
print vars(base.sub['inst'])
print
print vars(base.sub['inst'].sub['inst'])

-

The output from this program is the following:

{'parents': [__main__.A instance at 0x02179468, __main__.B instance
at 0x021794B8], 'sub': {'inst': __main__.B instance at 0x021794B8}}

{'parents': [__main__.A instance at 0x02179468, __main__.B instance
at 0x021794B8], 'sub': {'inst': __main__.B instance at 0x021794E0}}

{'parents': [__main__.A instance at 0x02179468, __main__.B instance
at 0x021794B8], 'sub': {}}

As you can see, the problem looks similar to the one before: All the
instances have an identical parent list. However, I don't understand
why as self.parents is declared in the __init__ method. Any ideas?
What I want is for the first instance to have an empty list, the
second to have one element in the list and the third to have two
parent elements.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Jon Clements
On Sep 5, 3:43 pm, Peter Otten __pete...@web.de wrote:
 Kristofer Tengström wrote:
  Thanks everyone, moving the declaration to the class's __init__ method
  did the trick. Now there's just one little problem left. I'm trying to
  create a list that holds the parents for each instance in the
  hierarchy. This is what my code looks like now:

  -

  class A:
      def __init__(self, parents=None):
          self.sub = dict()
          if parents:

 You should explicitly test for None here; otherwise in a call like

 ancestors = []
 a = A(anchestors)

 the list passed as an argument will not be used, which makes fore confusing
 behaviour.

              self.parents = parents
          else:
              self.parents = []
      def sub_add(self, cls):
          hierarchy = self.parents
          hierarchy.append(self)

 Here you are adding self to the parents (that should be called ancestors)
 and pass it on to cls(...). Then -- because it's non-empty -- it will be
 used by the child, too, and you end up with a single parents list.

          obj = cls(hierarchy)
          self.sub[obj.id] = obj

 While the minimal fix is to pass a copy

 def sub_add(self, cls):
     obj = cls(self.parents + [self])
     self.sub[obj.id] = obj

 I suggest that you modify your node class to keep track only of the direct
 parent instead of all ancestors. That makes the implementation more robust
 when you move a node to another parent.

I may not be understanding the OP correctly, but going by what you've
put here, I might be tempted to take this kind of stuff out of the
class's and using a graph library (such as networkx) - that way if
traversal is necessary, it might be a lot easier. But once again, I
must say I'm not 100% sure what the OP wants to achieve...

Jon.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Peter Otten
Jon Clements wrote:

 I
 must say I'm not 100% sure what the OP wants to achieve...

Learn Python? 

;)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help with simple OOP Python question

2011-09-05 Thread Terry Reedy

On 9/5/2011 9:15 AM, Kristofer Tengström wrote:

Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like now:

-

class A:
 def __init__(self, parents=None):
 self.sub = dict()
 if parents:
 self.parents = parents
 else:
 self.parents = []
 def sub_add(self, cls):
 hierarchy = self.parents
 hierarchy.append(self)
 obj = cls(hierarchy)
 self.sub[obj.id] = obj


Indexing objects by their internal id is usually useless. Considier 
whether you should be using sets rather than dicts.


--
Terry Jan Reedy


--
http://mail.python.org/mailman/listinfo/python-list


python question

2011-02-02 Thread Robin
how do you acccess a hash element in python 3? It completely changed
from version 2 and earlier, I think.

stop war straight up, direct or indectly,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python question

2011-02-02 Thread Benjamin Kaplan
On Wed, Feb 2, 2011 at 4:08 PM, Robin r...@thevoid1.net wrote:

 how do you acccess a hash element in python 3? It completely changed
 from version 2 and earlier, I think.


What do you mean by accessing a hash element? Do you mean the hash of
an object? Because that's stayed the same: hash(obj). Do you mean
accessing the values in a dict? Because that's also stayed the same:
dictionary[obj]. Or is it something else that you're looking for?

 --
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python question

2010-04-12 Thread DreiJane
Hello,

Python and gtk are ambulant (portable plus intallable by mere
copying without admin rights). gtk only needs to have the path to its /
bin on the PATH . The latter could - and possibly should be - done by
the Python scripts using it, for example:

s = os.environ['PATH']
if s.find(gtkBinDir) == -1: os.putenv(PATH, os.getenv(PATH)+
os.pathsep + gtkBinDir)

for gtkBinDir from some GlobalConstants.py.

Pygtk breaks that ambulance - its parts use the registry, but only
for finding Python during installation. Afterwards such a Python is
ambulant again - that means with its pygtk (this little flaw is a
minor reason for me to work on my depikt). I am on Windows normally,
but never considered pywin.

Good luck, Joost
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python question

2010-04-12 Thread DreiJane
Rereading my sent answer i wondered, what the variable s was used for
besides that find and found nothing. Without it also the layout is
better:

if os.environ['PATH'].find(gtkBinDir) == -1:
nbsp;nbsp;nbsp;nbsp; os.putenv(PATH, os.getenv(PATH)+
os.pathsep + gtkBinDir)
-- 
http://mail.python.org/mailman/listinfo/python-list


Python question

2010-04-09 Thread Binary
How much space approximately is required to install the following packs on 
Windows XP?


pycairo-1.4.12-2.win32-py2.6.exe
python-2.6.1.msi
pygobject-2.14.2-2.win32-py2.6.exe
pygtk-2.12.1-3.win32-py2.6.exe
pywin32-213.win32-py2.6.exe
gtk-2.12.9-win32-2.exe

Does all this packs requires installation,  or it's possible just extract 
and place them in to C: drive, then to set environment variables properly?
Does this packs installs dynamic libraries and writes to registry? 


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python question

2010-04-09 Thread Gabriel Genellina
En Fri, 09 Apr 2010 14:14:34 -0300, Binary  
nos...@news.eternal-september.org escribió:


How much space approximately is required to install the following packs  
on Windows XP?


pycairo-1.4.12-2.win32-py2.6.exe
python-2.6.1.msi
pygobject-2.14.2-2.win32-py2.6.exe
pygtk-2.12.1-3.win32-py2.6.exe
pywin32-213.win32-py2.6.exe
gtk-2.12.9-win32-2.exe


You might estimate it by the size of those files; use a factor of 2 or 3  
due to compression.



Does all this packs requires installation,


python and gtx must be installed as any other Windows program, and  
probably require administrator rights. I don't know all of the remaining  
files, but they look like Python packages; the installer typically drop  
some files into c:\python26\lib\site-packages and register something.


or it's possible just extract and place them in to C: drive, then to set  
environment variables properly?

Does this packs installs dynamic libraries and writes to registry?


Python and Gtk, yes. The other packages, maybe not.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


Re: compiling python question

2010-02-25 Thread Diez B. Roggisch

Am 25.02.10 01:55, schrieb Mag Gam:

sorry for the vague answer.

Its Linux.

The configure build does not say anything actually. This is for SAGE.
I managed to have it pick it up by compiling/installing tcl and tk and
then recompile python


Then most probably installing the tk-dev packages would have been 
sufficient.


diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: compiling python question

2010-02-24 Thread Diez B. Roggisch

Am 24.02.10 03:00, schrieb Mag Gam:

I am trying to compile python with Tk bindings. Do I need to do
anything special for python to detect and enable Tk?


What OS? What does the configure/build process say?

Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: compiling python question

2010-02-24 Thread Mag Gam
sorry for the vague answer.

Its Linux.

The configure build does not say anything actually. This is for SAGE.
I managed to have it pick it up by compiling/installing tcl and tk and
then recompile python


On Wed, Feb 24, 2010 at 4:50 PM, Diez B. Roggisch de...@nospam.web.de wrote:
 Am 24.02.10 03:00, schrieb Mag Gam:

 I am trying to compile python with Tk bindings. Do I need to do
 anything special for python to detect and enable Tk?

 What OS? What does the configure/build process say?

 Diez
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


compiling python question

2010-02-23 Thread Mag Gam
I am trying to compile python with Tk bindings. Do I need to do
anything special for python to detect and enable Tk?

This is mainly for matplotlib's TkAgg. It seems my compiled version of
python isn't finding the module _tkagg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python question

2009-05-22 Thread Craig

I use python 2.6.2 and i useing ubuntu 9.04 not windows.

--- On Thu, 5/21/09, Dave Angel da...@ieee.org wrote:

 From: Dave Angel da...@ieee.org
 Subject: Re: python question
 To: Craig fasteliteprogram...@yahoo.com
 Cc: python-list@python.org
 Date: Thursday, May 21, 2009, 2:22 PM
 Craig wrote:
  How do i install this.i never seen a python write in c
 before.
  
  
    
 Well, I've never seen a snake program in any language,
 python or otherwise.  And I believe python was named
 after Monty Python, not the snake.  But once it got its
 name, snake puns abound.
 
 Anyway, why not tell you what you want to install, and on
 what platform?  If it's Python 2.6.2 on MS Windows XP,
 just download and run the msi file.
    On web page:   http://www.python.org/download/, you'd choose Python
 2.6.2 Windows installer 
 http://www.python.org/ftp/python/2.6.2/python-2.6.2.msi 
 and it'd give you file python-2.6.2.msi
 
 
 
 


  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python question

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 05:51 -0700, Craig wrote:
 I use python 2.6.2 and i useing ubuntu 9.04 not windows.

What are you trying to install?

is it available in Synaptic package manager?


If it's a program written in python, then there may be a file called
setup.py. If there is then open a terminal, cd to that directory, and
then type:

python setup.py install

(you may need to do sudo before it) - that will normally automatically
compile any extensions written in C

hope that helps.


Tim W

-- 
http://mail.python.org/mailman/listinfo/python-list


python question

2009-05-21 Thread Craig

How do i install this.i never seen a python write in c before.


  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python question

2009-05-21 Thread Dave Angel

Craig wrote:

How do i install this.i never seen a python write in c before.


  
Well, I've never seen a snake program in any language, python or 
otherwise.  And I believe python was named after Monty Python, not the 
snake.  But once it got its name, snake puns abound.


Anyway, why not tell you what you want to install, and on what 
platform?  If it's Python 2.6.2 on MS Windows XP, just download and run 
the msi file.
   On web page:   http://www.python.org/download/, you'd choose Python 
2.6.2 Windows installer 
http://www.python.org/ftp/python/2.6.2/python-2.6.2.msi  and it'd give 
you file python-2.6.2.msi




--
http://mail.python.org/mailman/listinfo/python-list


Re: applescript/python question

2008-08-02 Thread Diez B. Roggisch

[EMAIL PROTECTED] schrieb:

I can't seem to figure this out.  I just installed Python 2.5.2 a few days ago 
on my OS X 10.4.11
system.  It runs fine and if I type Python -V in the Terminal it outputs Python 
2.5.2 which is
correct.  However, if I try to run a 'do shell script' in AppleScript which I'm 
wanting to run a Python
program, it reverts to using Python 2.3.  For example, if I run this code in 
AppleScript:


set p to #!/usr/bin/python
import sys
print sys.version[:3]
set x to do shell script Python -c \  p  \
return x


I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
version of Python?
Is there a way to fix this?


I guess the shebang is simply ignored - the actual interpreter is 
fetched from the Python -c-line.


It's a bit weird that there is Python with a capital P, but what happens 
if you change that to Python2.5 for example?


Diez
--
http://mail.python.org/mailman/listinfo/python-list


RE: applescript/python question

2008-08-02 Thread jyoung79
Hi Diez,

Thanks for your reply.  I gave this a try too, but it doesn't seem to work 
either.

However, a gentleman just emailed me off-list recommending to use the full path 
to Python that is in /usr/local/bin.  This is where Python 2.5 looks to be 
installed rather than Python 2.3 which is in /usr/bin.  I ran the following 
code below and it works great!

 
 set p to #!/usr/bin/python
 import sys
 print sys.version[:3]
 set x to do shell script /usr/local/bin/python -c \  p  \
 return x
 

Thank you all again for your thoughts and replies.  I really appreciate it!!

Jay

 I guess the shebang is simply ignored - the actual interpreter is 
 fetched from the Python -c-line.
 
 It's a bit weird that there is Python with a capital P, but what happens 
 if you change that to Python2.5 for example?
 
 Diez
--
http://mail.python.org/mailman/listinfo/python-list


applescript/python question

2008-08-01 Thread jyoung79
I can't seem to figure this out.  I just installed Python 2.5.2 a few days ago 
on my OS X 10.4.11
system.  It runs fine and if I type Python -V in the Terminal it outputs 
Python 2.5.2 which is
correct.  However, if I try to run a 'do shell script' in AppleScript which I'm 
wanting to run a Python
program, it reverts to using Python 2.3.  For example, if I run this code in 
AppleScript:


set p to #!/usr/bin/python
import sys
print sys.version[:3]
set x to do shell script Python -c \  p  \
return x


I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
version of Python?
Is there a way to fix this?

Thanks.

Jay
--
http://mail.python.org/mailman/listinfo/python-list


Re: applescript/python question

2008-08-01 Thread Sean DiZazzo
On Aug 1, 5:41 pm, [EMAIL PROTECTED] wrote:
 I can't seem to figure this out.  I just installed Python 2.5.2 a few days 
 ago on my OS X 10.4.11
 system.  It runs fine and if I type Python -V in the Terminal it outputs 
 Python 2.5.2 which is
 correct.  However, if I try to run a 'do shell script' in AppleScript which 
 I'm wanting to run a Python
 program, it reverts to using Python 2.3.  For example, if I run this code in 
 AppleScript:

 
 set p to #!/usr/bin/python
 import sys
 print sys.version[:3]
 set x to do shell script Python -c \  p  \
 return x
 

 I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
 version of Python?
 Is there a way to fix this?

 Thanks.

 Jay

Change the first line to

set p to #!/usr/bin/env python

That will execute the default python installation...assuming 2.5.2 is
the default.  Otherwise, you can change that to the absolute path of
the 2.5.2 version.

~Sean
--
http://mail.python.org/mailman/listinfo/python-list


RE:applescript/python question

2008-08-01 Thread jyoung79
Hi Sean,

Thanks for your fast reply.  This still doesn't seem to work.  I also tried 
changing it to
#!/usr/local/bin/python since it looks like the Python 2.5 items are actually 
in there.  I'm starting
to wonder if AppleScript's 'do shell script' command is actually looking in 
/usr/bin for Python by
default?

Thanks.

Jay

 Change the first line to
 
 set p to #!/usr/bin/env python
 
 That will execute the default python installation...assuming 2.5.2 is
 the default.  Otherwise, you can change that to the absolute path of
 the 2.5.2 version.
 
 ~Sean
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >