Python Forum
.dat file to xlsxl - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: .dat file to xlsxl (/thread-25678.html)

Pages: 1 2 3 4 5


RE: .dat file to xlsxl - Makada - Apr-24-2020

Hi buran,

Thanks again for your effort Smile
When i run the above code, i get the following error:

Traceback (most recent call last):
  File "C:\Users\Makada\Desktop\dat to csv kopie.py", line 22, in <module>
    last_update = df.TMSTAMP.iat[-1]
  File "C:\Python\lib\site-packages\pandas\core\generic.py", line 5274, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'TMSTAMP'
>>> 



RE: .dat file to xlsxl - buran - Apr-24-2020

it's probably something with your data/file. it was the same also in previous code and it was working, right.
Probably you should put some more effort debugging yourself


RE: .dat file to xlsxl - buran - Apr-24-2020

Note that you must delete the empty file you currently have in place. You either don't have file with taht name or have file with data. empty file with the same name will not work


RE: .dat file to xlsxl - Makada - Apr-24-2020

Yes youre right, i had to remove the old outputfile first, then the new code will make one itself.
I see it append sometimes one record, sometimes 2 when it is running.

[Image: Screenshot-20200424-211606.jpg]


RE: .dat file to xlsxl - buran - Apr-24-2020

time.sleep cannot guarantee precise 60 seconds interval. from the docs:
Quote:The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system

also, start wasn't exactly at the second, I guess
by the way, it's strange you get also microseconds in datetime columne


RE: .dat file to xlsxl - Makada - Apr-24-2020

Yes these microseconds are output from my datalogger.
I dont know how to remove them.

Re the 60 seconds sleep inaccuracy;
Is this method more secure?

schedule.every().minute.at(":01").do(task1)  
 
while True:
    schedule.run_pending()
    time.sleep(1)
refresh()
I noticed theres something with the time format.
As you can see in excel:
[Image: Screenshot-20200424-213412.png]


RE: .dat file to xlsxl - buran - Apr-24-2020

There is nothing with the format. check the axis, but I think the minimum resolution is day. you cannot set resolution in minutes.


RE: .dat file to xlsxl - buran - Apr-24-2020

as to your other question
Quote:How can I make sure long-running jobs are always executed on time?

Schedule does not account for the time it takes the job function to execute. To guarantee a stable execution schedule you need to move long-running jobs off the main-thread (where the scheduler runs). See “How to execute jobs in parallel?” in the FAQ for a sample implementation.



RE: .dat file to xlsxl - Makada - Apr-24-2020

I see when i choose cellproperties time in 13:30 for example, its working fine...

[Image: Screenshot-20200424-215131.png]


RE: .dat file to xlsxl - buran - Apr-24-2020

that is just time. In the other column you have date. Did you check what is minimum resolution there...
And sorry, but I am moving away from this thread...I cannot answer all you questions. You need to put more effort yourself. sorry