Re: Is there anything in the script which could cause it to not run its full course please?

2020-05-05 Thread Cameron Simpson

On 04May2020 17:17, ozst...@gmail.com  wrote:

On Tuesday, 5 May 2020 01:35:42 UTC+10, David Raymond  wrote:

Not necessarily the cause of your problem, but if you're going to compare dates 
it should be as objects, or as text as year-month-day. Here you're comparing 
dates as text in day-month-year format. So January first  comes before May 
4th 2020

"01-01-" < "04-05-2020"

[...]


Thank you, see what you mean. I have corrected this now.


It seem worth pointing out that this is why many of us like ISO8601 
dates, which are written from largest component to smallest component.  
For example:


   2020-05-04

They have the convenient property of sorting lexically as they would 
sort numerically.


But David's right on in saying that if you're comparing numbers, do it 
numerically. Comparing text when the underlying thing isn't text is the 
wrong approach.


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


Re: Is there anything in the script which could cause it to not run its full course please?

2020-05-04 Thread ozstar1
On Tuesday, 5 May 2020 01:35:42 UTC+10, David Raymond  wrote:
> Not necessarily the cause of your problem, but if you're going to compare 
> dates it should be as objects, or as text as year-month-day. Here you're 
> comparing dates as text in day-month-year format. So January first  comes 
> before May 4th 2020
> 
> "01-01-" < "04-05-2020"
> 
> ...
> 04-05-2020 09:30:00 40
> 04-05-2020 12:30:00 40
> 04-05-2020 15:30:00 40
> 04-05-2020 22:30:00 40
> ...
> input_date,input_time,input_duration=date_time_duration.split(' ')
> current_datetime = datetime.datetime.now()
> current_date = current_datetime.strftime('%d-%m-%Y')
> if(input_date>=current_date):
>while(True):
> ...

Thank you, see what you mean. I have corrected this now.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there anything in the script which could cause it to not run its full course please?

2020-05-04 Thread ozstar1


Many thanks for your help. It is really appreciated. I see both your points and 
maybe this is where my problems lays. 

If for example it starts (and it does) at 9.30am then the print is.. 
streaming  It is supposed to wait for the 40 minutes, stop then print 
this.. Waiting for the next stream to start at 12:30 however I get this same 
message maybe 4 minutes in, not 40.

I have checked for admin 'events' in Win10 1909 however there is nothing there, 
and the start menu has only 3 items, none that would effect this.

The box doesn't have anything else running, as it is virtually dedicated to 
this streaming. It has two displays, one for the stream program and the other 
for the dos box, so nothing is on the streamer screen where the mouse clicks.

Once again many thanks and let me digest your info. 
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Is there anything in the script which could cause it to not run its full course please?

2020-05-04 Thread David Raymond
Not necessarily the cause of your problem, but if you're going to compare dates 
it should be as objects, or as text as year-month-day. Here you're comparing 
dates as text in day-month-year format. So January first  comes before May 
4th 2020

"01-01-" < "04-05-2020"

...
04-05-2020 09:30:00 40
04-05-2020 12:30:00 40
04-05-2020 15:30:00 40
04-05-2020 22:30:00 40
...
input_date,input_time,input_duration=date_time_duration.split(' ')
current_datetime = datetime.datetime.now()
current_date = current_datetime.strftime('%d-%m-%Y')
if(input_date>=current_date):
   while(True):
...
-- 
https://mail.python.org/mailman/listinfo/python-list


Is there anything in the script which could cause it to not run its full course please?

2020-05-03 Thread ozstar1
Hi,

A nooby here and I could do with some help in finding out what, if anything, is 
wrong with the script

Is there anything in this script that could cause the stream to stop before the 
allocated time? 

For example the time.txt file which gives the times to the script, shows the 
time to start and run, like this..

04-05-2020 09:30:00 40
04-05-2020 12:30:00 40
04-05-2020 15:30:00 40
04-05-2020 22:30:00 40

When I run the the stream manually not using the script, it runs the full 40 
mins length however as soon as I use the script, it stops the stream a few 
minutes in. It is not any specific time, just a random time.

I see my two options are..
something in the script or
something going on in the PC background, although it doesn't do it when I don't 
use the script.

Please help and I am not sure where else to go as it does seem like a script or 
python event.

Thank you



-
import time
import datetime
import sys
from pynput.mouse import Button, Controller
class Autostreaming(object):
 
def __init__(self):
self.mouse = Controller()
pass
 
def startstreaming(self):
#load text file 
time_file = open("time.txt", "r")
for date_time_duration in time_file.readlines():
input_date,input_time,input_duration=date_time_duration.split(' ')
current_datetime = datetime.datetime.now()
current_date = current_datetime.strftime('%d-%m-%Y')
if(input_date>=current_date):
while(True):
_time = datetime.datetime.now()
current_time= _time.strftime('%H:%M:%S')
if(input_time==current_time):
#self.mouse.position = (1912,594)
#self.mouse.click(Button.left,1)
#time.sleep(2)
self.mouse.position = (1250,710)
self.mouse.click(Button.left,1)
time.sleep(2)
self.mouse.position = (1824,1136)
self.mouse.click(Button.left,1)
time.sleep(2)
self.mouse.position = (1587,37)
self.mouse.click(Button.left,1)
time.sleep(2)
self.mouse.position = (1250,710)
self.mouse.click(Button.left,1)
time.sleep(2)
#self.mouse.position = (1202, 806)
#self.mouse.click(Button.left,1)
print("streaming")
time.sleep(int(input_duration)*60)#please put your 
streaming function 
self.mouse.position = (1824,1136)
self.mouse.click(Button.left,1)
break
elif(input_time>current_time):
print('Waiting for the next stream to start at 
{}'.format(input_time)+" hrs on {}".format(input_date))
time.sleep(1)
continue
elif(input_date>current_date and input_timehttps://mail.python.org/mailman/listinfo/python-list