Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread US
From: "Yang, Gang CTR (US)" 

Hi,



I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008
R2) and tried the python --version command. Surprisingly, the command reported
2.5.4. What's going on?



Gang Yang

Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC
Office: 732-982-8561, x427

Cell: 732-788-7501 Email:
[email protected]<mailto:[email protected]>

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


100% without investment online part time jobs..(adsense, datawork, neobux..more jobs)

2010-08-04 Thread rosy us
100% without investment….no registration fee…no need money…
Online part time jobs…(googleadsense, dataentry…etc)all type of jobs…
 work from home..daily 2-3 hours…earn more money without any risk..


Full details at http://adsensejobworkfulldetails.co.cc/


More adsense tips,secrets,increasing money ,seo..also available…
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Parallel(?) programming with python

2022-08-09 Thread Schachner, Joseph (US)
Why would this application *require* parallel programming?   This could be done 
in one, single thread program.   Call time to get time and save it as 
start_time.   Keep a count of the number of 6 hour intervals, initialize it to 
0.

Once a second read data an append to list.  At 6 hours after start time, call a 
function that does an FFT (see comment about scipy below) and increment the 
count of 6 hour intervals.  Call time and save new start time. Continue 
execution.

After 28 six hour intervals, save the list and then slice the list to  shorten 
it as you want.  Reset the count of 6 hour intervals to zero.

The FFT might take a second, even if you use scipy, depending on how long the 
list is (If you don’t know about numpy and scipy, look them up! You need them.  
 Your list can be an array in numpy).  
Saving and slicing the list should take less than a second.

This single thread approach avoids thinking about multiprocessing, locking and 
unlocking data structures, all that stuff that does not contribute to the goal 
of the program.

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Andreas Croci  
Sent: Monday, August 8, 2022 6:47 AM
To: [email protected]
Subject: Parallel(?) programming with python

tI would like to write a program, that reads from the network a fixed amount of 
bytes and appends them to a list. This should happen once a second.

Another part of the program should take the list, as it has been filled so far, 
every 6 hours or so, and do some computations on the data (a FFT).

Every so often (say once a week) the list should be saved to a file, shorthened 
in the front by so many items, and filled further with the data coming fom the 
network. After the first saving of the whole list, only the new part (the data 
that have come since the last saving) should be appended to the file. A 
timestamp is in the data, so it's easy to say what is new and what was already 
there.

I'm not sure how to do this properly: can I write a part of a program that 
keeps doing its job (appending data to the list once every second) while 
another part computes something on the data of the same list, ignoring the new 
data being written?

Basically the question boils down to wether it is possible to have parts of a 
program (could be functions) that keep doing their job while other parts do 
something else on the same data, and what is the best way to do this.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to make a variable's late binding crosses the module boundary?

2022-08-30 Thread Schachner, Joseph (US)
The way we do this, is in main.py, call a "globalizer" function in each other 
file:

# call globalizers to get shortcuts as global variables
funcs.globalizer(interface, variable_dict)
util.globalizer(interface, variable_dict)
sd.globalizer(interface, variable_dict)
tests.globalizer(interface, variable_dict)
ut.globalizer(interface, variable_dict)

Obviously, you may not need a shared interface in which case you can just pass 
the variable dictionary.

In each file, you have a function:
def globalizer(interface, variables_dict):
# create global variables for this .py file for shared interface and the 
variables


This works well, making sure separate python files shared exactly the same 
things we want to be global.

 Joseph S.

Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Stefan Ram  
Sent: Tuesday, August 30, 2022 1:09 AM
To: [email protected]
Subject: Re: How to make a variable's late binding crosses the module boundary?

dn  writes:
>Build module.py as:
>***
>CONSTANT = 1

>def func():
>pass
>***

>then in the terminal:
>***
>Python 3.9.13 (main, May 18 2022, 00:00:00) [GCC 11.3.1 20220421 (Red 
>Hat 11.3.1-2)] on linux Type "help", "copyright", "credits" or 
>"license" for more information.
 from module import func as f

  In CPython one then can also:

print( f.__globals__[ "CONSTANT" ])
import sys
module = sys.modules[ f.__globals__[ "__name__" ]] print( module.CONSTANT ) 
CONSTANT = module.CONSTANT print( CONSTANT )

  .


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


Apparent Issue with Administrator Privileges

2022-10-18 Thread Walsh, Ginny (US)
Hello-

I've been struggling with resolving environmental variables issues and I 
believe it is linked to my company's administrator privileges. The program is 
called ChemPlugin and I am attempting to run it using Python 3.10.8 on Windows. 
I can't seem to get Python to recognize the PYTHONPATH that points to the 
ChemPlugin\src. I have to download ChemPlugin using my administrator login 
name, but  Python is loaded to my local user profile. I can't seem to bridge 
the gap.

I have been working with both the ChemPlugin group and our internal IT and we 
are all stumped. Is there any experience with this issue?

Thanks,

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


RE: A trivial question that I don't know - document a function/method

2022-10-24 Thread Schachner, Joseph (US)
I head a small software team much of whose output is Python.   I would 
gratefully accept any of the formats you show below.  My preference is #1.

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Paulo da Silva  
Sent: Saturday, October 22, 2022 4:58 PM
To: [email protected]
Subject: A trivial question that I don't know - document a function/method

Hi all!

What is the correct way, if any, of documenting a function/method?

1.
def foo(a,b):
""" A description.
a: Whatever 1
b: Whatever 2
"""
...

2.
def foo(a,b):
""" A description.
a -- Whatever 1
b -- Whatever 2
"""
...

3.
def foo(a,b):
""" A description.
@param a: Whatever 1
@param b: Whatever 2
"""
...

4.
def foo(a,b):
""" A description.
:param a: Whatever 1
:param b: Whatever 2
"""
...

5.
Any other ...

Any comments/suggestions are welcome.
Thanks.
Paulo

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


RE: Are Floating Point Numbers still a Can of Worms?

2022-10-24 Thread Schachner, Joseph (US)
Floating point will always be a can of worms, as long as people expect it to 
represent real numbers with more precision that float has.  Usually this is not 
an issue, but sometimes it is.  And, although this example does not exhibit 
subtractive cancellation, that is the surest way to have less precision that 
the two values you subtracted.  And if you try to add up lots of values, if 
your sum grows large enough, tiny values will not change it anymore, even if 
there are many of them  - there are simple algorithms to avoid this effect.  
But all of this is because float has limited precision.

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Pieter van Oostrum  
Sent: Sunday, October 23, 2022 10:25 AM
To: [email protected]
Subject: Re: Are Floating Point Numbers still a Can of Worms?

Mostowski Collapse  writes:

> I also get:
>
> Python 3.11.0rc1 (main, Aug 8 2022, 11:30:54)
 2.718281828459045**0.8618974796837966
> 2.367649
>
> Nice try, but isn't this one the more correct?
>
> ?- X is 2.718281828459045**0.8618974796837966.
> X = 2.36764897.
>

That's probably the accuracy of the underlying C implementation of the exp 
function.

In [25]: exp(0.8618974796837966)
Out[25]: 2.367649

But even your answer can be improved:

Maxima:

(%i1) fpprec:30$

(%i2) bfloat(2.718281828459045b0)^bfloat(.8618974796837966b0);
(%o2)  2.367648983187397393143b0

but:

(%i7) bfloat(%e)^bfloat(.8618974796837966b0);
(%o7)  2.36764900085638369695b0
surprisingly closer to Python's answer.

but 2.718281828459045 isn't e. Close but no cigar.

(%i10) bfloat(2.718281828459045b0) - bfloat(%e);
(%o10)   - 2.35360287471352802147785151603b-16

Fricas:

(1) -> 2.718281828459045^0.8618974796837966 

   (1)  2.367648_98319

(2) -> exp(0.8618974796837966)

   (2)  2.367649_00086

-- 
Pieter van Oostrum 
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to manage python shebang on mixed systems?

2022-11-07 Thread Schachner, Joseph (US)
Maybe you can't do this, but I would suggest only running on the Python 3 
systems.  Refuse to jump through hoops for the Python 2 system.  It is years 
out of date.
It is not hard to upgrade from Python 2 to Python 3.  There is a 2to3 utility, 
and after that there should be very few things you want to manually change.  
Perhaps you could encourage them to upgrade.

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Chris Green  
Sent: Monday, November 7, 2022 4:06 AM
To: [email protected]
Subject: Re: How to manage python shebang on mixed systems?

Cameron Simpson  wrote:
> On 06Nov2022 20:51, jak  wrote:
> >Il 06/11/2022 11:03, Chris Green ha scritto:
> >>I have a number of python scripts that I run on a mix of systems.  I 
> >>have updated them all to run on python 3 but many will also run 
> >>quite happily with python 2.  They all have a #!/usr/bin/python3 shebang.
> 
> I usually use:
> 
> #!/usr/bin/env python3
> 
> This runs the default "python3" from my $PATH, whatever that is, 
> avoiding a hardwired path to the python3 executable.
> 
Yes, that's probably a good idea, less likely to break than mine.


> >>This works almost everywhere but there is one system where only 
> >>python 2 is available (at /usr/bin/python).
> >>
> >>I don't have python 2 on any of the systems I manage myself now so a 
> >>#!/usr/bin/python shebang will fail.
> >>
> >>Is there a neat way of handling this?  I could write a sort of 
> >>wrapper script to run via the shebang but that seems overkill to me.
> 
> It is overkill. I generally dislike batch editing scripts.
> 
> 1: do these scripts work on both python2 and python3? It seems like 
> they would need to.

Yes, they do, they're mostly very simple utility scripts for doing things like 
changing spaces to underscores in filenames and such.
Just putting 'print' parameters in brackets was all that most of them needed to 
work in python 3.


> 2: write a tiny script _named_ "python3" which invokes python 2. I 
> keep a personal "~/bin-local" directory for just such per-system 
> special commands like this.
> 3: with your pseudo "python3" script in place, make all the scripts 
> use the "#!/usr/bin/env python3" shebang suggested above.
> 
Yes, that sounds a good plan to me, thanks Cameron.

--
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Top level of a recursive function

2022-12-13 Thread Schachner, Joseph (US)
Reducing repetitiveness has made this code harder to read. I had to think about 
what it is doing.  It might be slightly faster, but in my opinion it is not 
worth it.  

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Stefan Ram  
Sent: Tuesday, December 13, 2022 10:25 AM
To: [email protected]
Subject: Re: Top level of a recursive function

Supersedes: 

[email protected] (Stefan Ram) writes:
>def rest( s ):
>return "(" + s[ 0 ] +( rest( s[1:] ) if len( s )> 1 else '' )+ ')'
>def nest( s ):
>return( s[ 0 ] if s else '' )+( rest( s[1:] )if len( s )> 1 else '' )

  Below, I have tried to reduce repetitiveness a bit.

  (PS: Now, one "if" remains; less ifs are not possible
  in the case of controlled recursion.)

def rest( s ):
return '(' + nest( s )+ ')'

def nest( s ):
return s[ :1 ]+( rest( s[ 1: ])if s[ 1: ]else '' )

fred = nest


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


Online Poker Pays! Learn All The Secrets Now!NBP Unregistered.

2005-10-29 Thread Poker Paid Us
Did you know that online Poker pays huge money? In the last three days my wife and I have made over 343.00 USD with online poker while we slept
Want to know our secret? Click HERE
and visit a link of your choice. 
-- 
http://mail.python.org/mailman/listinfo/python-list

Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread Yang, Gang CTR (US)
Hi,



I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008 
R2) and tried the python --version command. Surprisingly, the command reported 
2.5.4. What's going on?



Gang Yang

Shonborn-Becker Systems Inc. (SBSI)
Contractor Engineering Supporting SEC
Office: 732-982-8561, x427

Cell: 732-788-7501
Email: [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread Yang, Gang CTR (US)
Hi,



I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008
R2) and tried the python --version command. Surprisingly, the command reported
2.5.4. What's going on?



Gang Yang

Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC
Office: 732-982-8561, x427

Cell: 732-788-7501 Email:
[email protected]

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


RE: [Non-DoD Source] Re: Python 3.5.0 python --version command reports 2.5.4

2016-09-07 Thread Yang, Gang CTR (US)
Thanks to all that replied. Indeed I had CollabNet SVN server installed a while 
back and it came with an older version of Python.



Gang Yang

Shonborn-Becker Systems Inc. (SBSI)
Contractor Engineering Supporting SEC
Office: 732-982-8561, x427

Cell: 732-788-7501
Email: [email protected]<mailto:[email protected]>


From: Python-list [[email protected]] on 
behalf of Terry Reedy [[email protected]]
Sent: Wednesday, September 07, 2016 12:42 AM
To: [email protected]
Subject: [Non-DoD Source] Re: Python 3.5.0 python --version command reports 
2.5.4

All active links contained in this email were disabled.  Please verify the 
identity of the sender, and confirm the authenticity of all links contained 
within the message prior to copying and pasting the address to a Web browser.






On 9/6/2016 4:59 PM, [email protected] wrote:

> I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008
> R2) and tried the python --version command. Surprisingly, the command reported
> 2.5.4. What's going on?

Most likely you have 2.5.4 installed and are running it.

--
Terry Jan Reedy

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


How to configure trusted CA certificates for SSL client?

2017-02-07 Thread Yang, Gang CTR (US)
Hi,



I'm using Python 3.X (3.5 on Windows 2008 and 3.4 on CentOS 6.7) and 
encountered an SSL client side CA certificates issue. The issue came up when a 
third-party package (django-cas-ng) tried to verify the CAS service ticket (ST) 
by calling CAS server using requests.get(...) and failed with 
CERTIFICATE_VERIFY_FAILED error. The CAS server is accessed by HTTPS with a 
self-signed server certificate. Following some suggestions on the internet, 
I've tried to modify django-cas-ng's code to call requests.get(..) with verify 
parameter, such as requests.get(..., verify=False) and requests.get(..., 
verify="CAS server cert"). Both workarounds worked, but I can't change 
third-party package code. I also tried to add the CAS server cert to the 
underlying OS (Windows 2008 and CentOS 6.7), but it did not help.



My question is where does SSL client code get the trusted CA certificates from, 
from Python or the underlying OS? What configuration do I need in order for the 
SSL client to conduct the SSL handshake successfully?



Appreciate any help!



Gang



Gang Yang

Shonborn-Becker Systems Inc. (SBSI)
Contractor Engineering Supporting SEC
Office: 732-982-8561, x427

Cell: 732-788-7501
Email: [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Not able to get utf8 encoded string into a document

2008-05-09 Thread Lawrence, Anna K (US SSA)
Hi all,

 

This is my first post and I'm really at a loss for how to fix my
problem, so I really hope someone can help me out.

 

I am working on a web application using Pylons .0.9.6, SQLAlchemy 0.4.4,
MySQLdb 1.2.2 and Python 2.4.4.

 

We want to use utf8 encoding throughout and as far as I can see
everything is set properly between components and I've got a
sitecustomize.py in my site-packages directory of python set to utf8 as
well.  Everything is stored properly in the database and displays nicely
in the app.  However, when I try to take a string that is coming out of
the database and export it to a Word document, no amount of
encoding/decoding will make the Word doc display properly.

 

Since I'm on a Windows machine, my default locale is cp437.  Is this the
reason?

 

Is there something that needs to be set that I'm missing?  Any help
would be greatly appreciated.

 

Thanks,

Anna

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