« first day (4093 days earlier)      last day (846 days later) » 

6:24 AM
should this be a canonical? or do we have a better one for the relatively common beginner question of forgetting to put a shebang and have the shell try to execute their Python script? stackoverflow.com/questions/30285154/…
 
7:11 AM
I'm not aware of a better one off the top of my head. It's certainly a reasonably good one
framebuffers on Linux are fun <3
 
 
4 hours later…
11:11 AM
Hi, how can I loop over this kind of list and for each loop remove last item in list and print it?

# TELEFONAI PIGUS SAMSUNG
# Output -> TELEFONAI PIGUS, TELEFONAI
 
11:26 AM
def main():
    object_list = all_row_list()
    table_html_rows = create_table_rows(object_list)
    script_directory = os.path.dirname(os.path.realpath(__file__))
    html_report_path = os.path.join(script_directory, "report_template.html")
    html_report_as_text = get_text_file_contents(html_report_path)
    html_message = html_report_as_text.replace("[table_rows]", table_html_rows)
main()

/*sample data*/
"data Jan-1":
id   Data     status                  Connected            Comment
1    server1   200                     True                 Ok
I have one function which generate and replace html report and later it use to send the report over html every day,
Can it be possible to check and compare if any difference in report then only send the html report.
 
@DziuGas That isn't a list and the last item of the string isn't removed, so I'm not sure what you're asking
@ansh1 You could possibly do something like this but you haven't been very specific about what a difference is
I fell asleep with YouTube playing and woke up to find the laptop died half way through "Is Hegel Dead—Or Are We Dead in the Eyes of Hegel? A Hegelian View of the Present Age". I don't know how youtube put me there but I can only hope it injected some new philosophical wisdom into my sleeping brain
 
11:41 AM
:53741689 Difference can be any column ,like status, connected or comment which may change.
Example if both id data are same then don't send the report , if any changes
example id 2 is updated as below , so in this case we need to send the report.

2    server2   200                    False                Ok

send_smtp_mail(
        .....
        body=html_message,
        .....
        }
 
In which case, the method I showed you should work because you'll have multiple entries for each server
 
I don't understand the problem. If you have access to the old report, all you need is an if old_report == new_report:. If you don't have access to the old report, you need magic.
 
That would be an idiomatic approach but, assuming your reports are small enough, you'd be able to iterate through the rows (I don't normally advocate iterating dataframes but if it's enough to get you to the point you have something at least functional, it would be easier for us to help you)
I've never tried df1 == df2 so I don't know how that plays out and/or whether it's brittle for practical purposes
 
"report_template.html" need to be stored and new "report_template.html" after generate should compare the previous report and if any differences then send_smtp_mail
 
Although pandas does appear to have an equals method
 
11:47 AM
@roganjosh Are we even sure whether pandas is involved or not? Because I'm not
 
I'm not, but it probably should be, looking at the format of the reports
I suppose the html could be more complex and blow pandas' parser, so it's probably too much of a leap for me to say that actually
In which case, @ansh1, we're asking for clarification on the actual details of the problem. We understand the overall goal, but you'll need to think about the points Aran and I are talking about
FWIW, I've actually been impressed with pandas handling of HTML in the past. It's pretty good at disassembling pages into tables (where they exist). I'm not used to things being straightforward with pandas, so that was a pleasant surprise. Of course... if there's no actual <table>....
 
iterate through the rows !!
 
You've only just seen that?
 
html report is in this format:

<table>
    <tr>
      <th>id</th>
      <th>Data</th>
      <th>status</th>
      <th>Connected</th>
      <th>Comment</th>
    </tr>
    [table_rows]
  </table>
 
In which case, pandas will parse it just fine
I would enforce an ordering on the rows by the Data column and then use the equals method I linked earlier
Ok, actually, that seems a bit weird. It takes the index numbers into account so even if you sort by Data it could still throw false positives for changes, so you have to do the bit that I hashed out:
import pandas as pd

df = pd.DataFrame({'a': [1, 2, 3, 4],
                   'b': ['w', 'x', 'y', 'z']})

df2 = df.copy()
df2 = df2.sample(frac=1).reset_index(drop=True)
print(df2.head())

print(df.equals(df2))
df2 = df2.sort_values(by='a')#.reset_index().drop('index', axis=1)
print(df2.head())
print(df.equals(df2))
Or, rather df2 = df2.sort_values(by='a').reset_index(drop=True) sorry. I went a circuitous route because I wasn't sure quite what was happening
 
12:18 PM
cabbage y'all world class pythonistas
 
cbg :)
This is a really cool way to have a bi-lingual CV. I can't write anything useful in another language, but I need those frontend secrets
"OK. So you're looking at that CV source." I've been busted :/
 
j'ai j'ai j'ai j'ai......... panier!
 
12:39 PM
@Aran-Fey @roganjosh last time it took 2 days to figure out ansh1's real problem. I recommend not moving a finger to help them until they present an unambiguous MCVE.
 
+ 3 unit tests
 
That too
 
@AndrasDeak I agree and I learned from past feedback and this time I presented my ques clear to understand . Thanks
 
1 hour ago, by Aran-Fey
I don't understand the problem. If you have access to the old report, all you need is an if old_report == new_report:. If you don't have access to the old report, you need magic.
 
@roganjosh by roganjosh : We understand the overall goal,
 
12:52 PM
Please don't cherry-pick bits of my comments, you know what was said immediately after that. This isn't a debate that I am involved in, but I do find that objectionable to do
 
 
3 hours later…
3:28 PM
@roganjosh Frankie Boyle also sums up the year... bbc.co.uk/iplayer/episode/m0012xvf/…
 
3:45 PM
I think I need to get that and Cunk lined up for my New Year. I still don't have any plans; do you?
Cunk will probably pick me up, so I think I'll watch Frankie Boyle first
 
4:31 PM
"progress bar watcher" project update: After much faffing about, I'm getting the data I've been looking for. Now to choose how to present this data to the user. This will also require much faffing about.
Jon's "put it on the system tray" suggestion at chat.stackoverflow.com/transcript/message/53725001#53725001 would be quite nice to have. I don't know if Windows can do that though.
I can put a little 16x16 icon next to the clock, but I don't know if I can put anything like the KB/sec indicator as seen in that screenshot
 
Since Windows 7, icons in the task bar can also function as a progress bar. But I think in order to appear in the task bar, your app must have a window
 
Yeah, I was just looking at docs.microsoft.com/en-us/windows/win32/shell/…, which says something similar
I don't mind my app having a window. The vast majority of my projects do anyway, either a shell or a tkinter window
 
Alternatively, you could use a tray icon to indicate whether the app needs input from you (for example by making the icon a bright red), and display progress only when you hover the mouse over the icon
 
4:46 PM
Also a very compelling feature. Now it just comes down to, how many hoops do I have to jump through to actually make it work
If I see the words "device independent bitmap" then I know I'll have to crawl through at least a little bit of broken glass
 
The tray icon is probably significantly easier
 
 
1 hour later…
6:11 PM
"I know this is an old question but maybe someone will find it useful.". The rare Reverse DenverCoder9. Maybe I will find it useful.
But before I can use that code, I need to get the .tbl file. But before I can get the tbl file, I need the Windows SDK and/or an IDL compiler. But before I can use those, I need the .idl file. The .idl file is easy to get, at least -- I just need to copy-paste some inscrutable C code from a sketchy tech forum I've never heard of
 
Toldya to go with the tray icon
 
Orrrr I could programmatically generate 100 different icon image files, each one representing a progress percentage, and switch between them with root.iconbitmap(filename).
But remember to call ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("unique string literal unlikely to be used by any application group already in the taskbar") first, or else it will just show the default Python icon
 
7:22 PM
@Kevin Best way there is :)
 
"If it's dumb and it works, it's not dumb" -- ancient wisdom
I might apply more elbow grease to the problem if I was worried my user base would cry that my non-transparent icon is messing up the glassy aesthetic of their taskbar. But my user base is me, and a quick poll reveals that 100% of me doesn't care
 
@Kevin Words to live by
 
 
4 hours later…
11:41 PM
So anything new in the python world?
 
Python 3.6 is dead
So no, nothing new, just less of the old stuff
 

« first day (4093 days earlier)      last day (846 days later) »