Re: comp.lang.python

2019-02-12 Thread Ian Hobson

On 12/02/2019 05:54, Jaya Priya wrote:

The comp.lang.python.announce newsgroup (or c.l.py.a for short) has been 
created in early 1998 as a companion newsgroup for comp.lang.python focused on 
Python-related announcements. ... other items of general interest to the Python 
community.
https://www.gangboard.com/big-data-training/data-science-training


Wow! I know Nagels algorithm backed off, but over 20 years! Impressive!

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


Intel Distribution for Python

2019-02-12 Thread ElChino

I just got an Intel newsletter describing
"Intel Distribution for Python".

Quote:
  With Intel® Distribution for Python, it’s not unusual
  to see speed-ups of 20x (or more) for numerically intensive
  Python codes like those that use the Numpy* and SciPy* stack.

Sounds very exiting; 20 times speed-up! Has anybody tried it
and found this claim to be true?

Ref:
  https://software.intel.com/en-us/distribution-for-python/
--
https://mail.python.org/mailman/listinfo/python-list


A limit to writing to a file from a loop?

2019-02-12 Thread Steve
My program reads from a text file (A), modifies the data, and writes to another 
file (B).
This works until I reach about 300 writes and no more lines are written to file 
(B).

I had to create a Counter and increment it to 250 when it gets reset.  

Upon reset, I close the file (B) being written and reopen it for append.  

Then it accepts the entire list of lines of data.

 

Bizarre?

 

CycleCounter += 1

if CycleCounter > 250:

  CycleCounter = 1

  DateReadings.close()

  DateReadings=open("Date-ReadingsAndDoses.txt", "a")   
 

  DateReadings.write("{0:15} {1:>8} {2:>8} {3:>8} {4:<2} {5:>8} 
{6:>8} {7:>10}".format

  (ThisTimeDate, ThisReading, ThisDose1, 
ThisSensor, ThisTrend,

   ThisTS, ThisPercent, SensorNumberDay2) + "\n")



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


Re: A limit to writing to a file from a loop?

2019-02-12 Thread Chris Angelico
On Wed, Feb 13, 2019 at 5:58 AM Steve  wrote:
>
> My program reads from a text file (A), modifies the data, and writes to 
> another file (B).
> This works until I reach about 300 writes and no more lines are written to 
> file (B).
>
> I had to create a Counter and increment it to 250 when it gets reset.
>
> Upon reset, I close the file (B) being written and reopen it for append.
>
> Then it accepts the entire list of lines of data.
>
>
>
> Bizarre?

Without knowing what else is going on, we have no idea what the
problem is. All we see is your workaround.

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


Re: A limit to writing to a file from a loop?

2019-02-12 Thread DL Neil

Steve,

On 13/02/19 7:56 AM, Steve wrote:

My program reads from a text file (A), modifies the data, and writes to another 
file (B).
This works until I reach about 300 writes and no more lines are written to file 
(B).
I had to create a Counter and increment it to 250 when it gets reset.
Upon reset, I close the file (B) being written and reopen it for append.
Then it accepts the entire list of lines of data.
Bizarre?

  
 CycleCounter += 1

 if CycleCounter > 250:
   CycleCounter = 1
   DateReadings.close()
   DateReadings=open("Date-ReadingsAndDoses.txt", "a")
   DateReadings.write("{0:15} {1:>8} {2:>8} {3:>8} {4:<2} {5:>8} {6:>8} 
{7:>10}".format
   (ThisTimeDate, ThisReading, ThisDose1, 
ThisSensor, ThisTrend,
ThisTS, ThisPercent, SensorNumberDay2) + "\n")



Perhaps part of the transfer to email, but won't this code only output 
once per 250 records, cf 250 records per cycle?



Some suggestions:-

Test one: Prove that there is valid input
- is the code successfully reading more than '250' records?

Test two: Check the actual data
- is there anything strange about the '250th' record (the one that first 
exhibits the problem)?


Test three: Prove that it is not some Python<->file system issue
- what happens if the first input record is written (to a 'junk file') 
250+ times?


Test four: (possibly unnecessary after the above) Disprove a size issue
- what happens if you output a simple/hello world string (of the same 
number of bytes) instead of the incoming data, 250+ times?



Report back. If there are still problems, please show the original code 
and exception report...


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


Re: The slash "/" as used in the documentation

2019-02-12 Thread Peter J. Holzer
On 2019-02-12 07:31:54 +1100, Chris Angelico wrote:
> Positional arguments with defaults is a concept known in MANY
> languages,

True.

> including C.

Nope. At least not until C99, and I can't find anything in C11 either. 
Maybe they'll add it in C2x.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | [email protected] | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


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


I cannot seem to write time/date to the file.

2019-02-12 Thread Steve
I am using nowTimeDate2 elsewhere in my program and it can be printed to the 
screen.

The file exists and the program successfully opens the file, writes to it, and 
closes the file.

All is working as designed.

 

However,

Now I want to place an entry into the first line of the file to note the 
time/date the file was created.
It doesn’t show up in the file.

How do I fix this?

 

from time import gmtime, strftime 

nowTimeDate2=strftime("%Y %a %b %d %H:%M") 

print(nowTimeDate2)  #This works

DateReading=open("Date-ReadingsAndDoses.txt", "w")

DateReading.write = (nowTimeDate2 + "\n")

DateReading.close()

 

I also tried to append but that did not work either.

Interestingly enough, this is a feature that really has no real purpose in the 
final product yet it is hounding me.

 

 

 

Footnote:

 

 Ultrasound Technician Asks Pregnant Woman If She’d Like To Know Baby’s Name

 

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


Re: Replicating YouTube video AI code in python

2019-02-12 Thread Abdur-Rahmaan Janhangeer
try 3.6.6

Abdur-Rahmaan Janhangeer
http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: I cannot seem to write time/date to the file.

2019-02-12 Thread David Raymond
DateReading.write = (nowTimeDate2 + "\n")

You're re-assigning the write method to be a string here. You want to call the 
method with the string as the argument.

DateReading.write(nowTimeDate2 + "\n")



-Original Message-
From: Python-list 
[mailto:[email protected]] On Behalf Of 
Steve
Sent: Tuesday, February 12, 2019 2:20 PM
To: [email protected]
Subject: I cannot seem to write time/date to the file.

I am using nowTimeDate2 elsewhere in my program and it can be printed to the 
screen.

The file exists and the program successfully opens the file, writes to it, and 
closes the file.

All is working as designed.

 

However,

Now I want to place an entry into the first line of the file to note the 
time/date the file was created.
It doesn’t show up in the file.

How do I fix this?

 

from time import gmtime, strftime 

nowTimeDate2=strftime("%Y %a %b %d %H:%M") 

print(nowTimeDate2)  #This works

DateReading=open("Date-ReadingsAndDoses.txt", "w")

DateReading.write = (nowTimeDate2 + "\n")

DateReading.close()

 

I also tried to append but that did not work either.

Interestingly enough, this is a feature that really has no real purpose in the 
final product yet it is hounding me.

 

 

 

Footnote:

 

 Ultrasound Technician Asks Pregnant Woman If She’d Like To Know Baby’s Name

 

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


Re: The slash "/" as used in the documentation

2019-02-12 Thread Chris Angelico
On Wed, Feb 13, 2019 at 6:18 AM Peter J. Holzer  wrote:
>
> On 2019-02-12 07:31:54 +1100, Chris Angelico wrote:
> > Positional arguments with defaults is a concept known in MANY
> > languages,
>
> True.
>
> > including C.
>
> Nope. At least not until C99, and I can't find anything in C11 either.
> Maybe they'll add it in C2x.
>

Huh, my bad. C++ has it, but C still doesn't. Anyhow, defaults on
function arguments are supported in WAY more languages than keyword
arguments are.

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


RE: A limit to writing to a file from a loop?

2019-02-12 Thread Steve
Very good points.  In short, I wrote two test programs.  
One to write 400 lines of data into a file.  
Another to read it, modify it, and write to a new file.  

With some questionable spacing in the final file, I was able to read/write 400 
lines of code disproving my original suspicion. Back to the drawing board but 
at least I can write all the lines using my work around in the original 
program.  The question is why is there a difference?.  I will post again if I 
find something.
The plot thickens.
TTKMAWAN...


>>> Test one: Prove that there is valid input
>>> - is the code successfully reading more than '250' records?

Yes, when I close the file and reopen it, all 500 records are read/written.
I placed an additional line of data into the file being written which should 
have pushed an offending line of data to the 251st position. 250 lines were 
read/written and the original 250th line was not written.

>>> Test two: Check the actual data
>>> - is there anything strange about the '250th' record (the one that first 
>>> exhibits the problem)?

I placed an additional line of data at the beginning of file being read, the 
writing of said data should have pushed an offending line of data being written 
to the 251st position. 250 lines were read/written and the original 250th line 
was not written.

>>> Test three: Prove that it is not some Python<->file system issue
>>> - what happens if the first input record is written (to a 'junk file') 
>>> 250+ times?

>>> Test four: (possibly unnecessary after the above) Disprove a size issue
>>> - what happens if you output a simple/hello world string (of the same 
>>> number of bytes) instead of the incoming data, 250+ times?


Footnote:
Ultrasound Technician Asks Pregnant Woman If She’d Like to Know Baby’s Name...

-Original Message-
From: DL Neil  
Sent: Tuesday, February 12, 2019 2:13 PM
To: Steve ; [email protected]
Subject: Re: A limit to writing to a file from a loop?

Steve,

On 13/02/19 7:56 AM, Steve wrote:
> My program reads from a text file (A), modifies the data, and writes to 
> another file (B).
> This works until I reach about 300 writes and no more lines are written to 
> file (B).
> I had to create a Counter and increment it to 250 when it gets reset.
> Upon reset, I close the file (B) being written and reopen it for append.
> Then it accepts the entire list of lines of data.
> Bizarre?
> 
>   
>  CycleCounter += 1
>  if CycleCounter > 250:
>CycleCounter = 1
>DateReadings.close()
>DateReadings=open("Date-ReadingsAndDoses.txt", "a")
>DateReadings.write("{0:15} {1:>8} {2:>8} {3:>8} {4:<2} {5:>8} 
> {6:>8} {7:>10}".format
>(ThisTimeDate, ThisReading, ThisDose1, 
> ThisSensor, ThisTrend,
> ThisTS, ThisPercent, SensorNumberDay2) 
> + "\n")


Perhaps part of the transfer to email, but won't this code only output once per 
250 records, cf 250 records per cycle?


Some suggestions:-

Test one: Prove that there is valid input
- is the code successfully reading more than '250' records?

Test two: Check the actual data
- is there anything strange about the '250th' record (the one that first 
exhibits the problem)?

Test three: Prove that it is not some Python<->file system issue
- what happens if the first input record is written (to a 'junk file') 
250+ times?

Test four: (possibly unnecessary after the above) Disprove a size issue
- what happens if you output a simple/hello world string (of the same 
number of bytes) instead of the incoming data, 250+ times?


Report back. If there are still problems, please show the original code 
and exception report...

-- 
Regards =dn


Footnote:
Ultrasound Technician Asks Pregnant Woman If She’d Like To Know Baby’s Name

-Original Message-
From: DL Neil  
Sent: Tuesday, February 12, 2019 2:13 PM
To: Steve ; [email protected]
Subject: Re: A limit to writing to a file from a loop?

Steve,

On 13/02/19 7:56 AM, Steve wrote:
> My program reads from a text file (A), modifies the data, and writes to 
> another file (B).
> This works until I reach about 300 writes and no more lines are written to 
> file (B).
> I had to create a Counter and increment it to 250 when it gets reset.
> Upon reset, I close the file (B) being written and reopen it for append.
> Then it accepts the entire list of lines of data.
> Bizarre?
> 
>   
>  CycleCounter += 1
>  if CycleCounter > 250:
>CycleCounter = 1
>DateReadings.close()
>DateReadings=open("Date-ReadingsAndDoses.txt", "a")
>DateReadings.write("{0:15} {1:>8} {2:>8} {3:>8} {4:<2} {5:>8} 
> {6:>8} {7:>10}".format
>(ThisTimeDate, ThisReading, ThisDose1, 
> ThisSensor, ThisTrend,
> ThisTS, ThisPercent, SensorNumberDay2) 
> + "\n")


Perhaps part of the transfer to em

RE: I cannot seem to write time/date to the file.

2019-02-12 Thread Steve
That was it, will wonders never cease?
Thanks



Footnote:
Ultrasound Technician Asks Pregnant Woman If She’d Like To Know Baby’s Name

-Original Message-
From: Python-list  On Behalf 
Of David Raymond
Sent: Tuesday, February 12, 2019 2:28 PM
To: [email protected]
Subject: RE: I cannot seem to write time/date to the file.

DateReading.write = (nowTimeDate2 + "\n")

You're re-assigning the write method to be a string here. You want to call the 
method with the string as the argument.

DateReading.write(nowTimeDate2 + "\n")



-Original Message-
From: Python-list 
[mailto:[email protected]] On Behalf Of 
Steve
Sent: Tuesday, February 12, 2019 2:20 PM
To: [email protected]
Subject: I cannot seem to write time/date to the file.

I am using nowTimeDate2 elsewhere in my program and it can be printed to the 
screen.

The file exists and the program successfully opens the file, writes to it, and 
closes the file.

All is working as designed.

 

However,

Now I want to place an entry into the first line of the file to note the 
time/date the file was created.
It doesn’t show up in the file.

How do I fix this?

 

from time import gmtime, strftime 

nowTimeDate2=strftime("%Y %a %b %d %H:%M") 

print(nowTimeDate2)  #This works

DateReading=open("Date-ReadingsAndDoses.txt", "w")

DateReading.write = (nowTimeDate2 + "\n")

DateReading.close()

 

I also tried to append but that did not work either.

Interestingly enough, this is a feature that really has no real purpose in the 
final product yet it is hounding me.

 

 

 

Footnote:

 

 Ultrasound Technician Asks Pregnant Woman If She’d Like To Know Baby’s Name

 

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

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