Hi,
I have a python script which creates a csv file using following method -
def printOutInformation(self):
-
if self.orderby == 'r':
-
self.iplist.sort(cmp=self.RealtimeComparison)
-
elif self.orderby == 'p':
-
self.iplist.sort(cmp=self.ProcessingtimeComparison)
-
# by default the order will just be the order that the IPs were in the reasoning log
-
if csvoutput:
-
csvfile = open(self.csvfile, 'w')
-
csvfile.write("IP Address,Total Time Elapsed,Pipeline Processing Time,Start Time,End Time\n")
-
for list in self.iplist:
-
ip, realtime, processingtime, starttimestamp, endtimestamp = list
-
csvfile.write("%s,%s,%s,%s,%s\n" % (ip, realtime, processingtime, starttimestamp.isoformat(), endtimestamp.isoformat()))
-
csvfile.close()
I want to run the additional shell script once the above csv file has been generated.
Any Hints
Thanks
Mehdi
2 11068 - import os
-
cwd = os.getcwd() # this will get the path you are current in if you need it
-
os.system('sh script.sh')
bartonc 6,596
Recognized Expert Expert
Hi,
I have a python script which creates a csv file using following method -
def printOutInformation(self):
-
if self.orderby == 'r':
-
self.iplist.sort(cmp=self.RealtimeComparison)
-
elif self.orderby == 'p':
-
self.iplist.sort(cmp=self.ProcessingtimeComparison)
-
# by default the order will just be the order that the IPs were in the reasoning log
-
if csvoutput:
-
csvfile = open(self.csvfile, 'w')
-
csvfile.write("IP Address,Total Time Elapsed,Pipeline Processing Time,Start Time,End Time\n")
-
for list in self.iplist:
-
ip, realtime, processingtime, starttimestamp, endtimestamp = list
-
csvfile.write("%s,%s,%s,%s,%s\n" % (ip, realtime, processingtime, starttimestamp.isoformat(), endtimestamp.isoformat()))
-
csvfile.close()
I want to run the additional shell script once the above csv file has been generated.
Any Hints
Thanks
Mehdi
Hello, Mehdi. I've added CODE tags to your post to make it readable. You will learn how to do this as we go along. Instructions are in "Posting Guidelines" in several places on this forum. Also, We need to know which operating system you are on, in order to give the correct information.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Valentine Kouznetsov |
last post by:
Hi,
simple question, how to execute command in current shell, not in
subshell?
Example. I have environment variable A=aaa and need to invoke shell
(sh) script which will do something with A. If I do os.system() then
sub-shell will setup A
and execute my script there leaving A in parent shell untouched.
Thanks,
|
by: Daven Nair |
last post by:
Hi,
I would like to know if Python supports codes similar to shell scripts:
count=`ps -ef|grep "pattern"|wc -l`
for count in `echo $count`
do
done
fi
|
by: bikkaran |
last post by:
Hi .
I have to write a Shell script like ...
IF "select value from tablnema where condition;" = some_value
then
depending upon the this value I will call some other script.sql
This query will always return 1 value.
Can some one help me how to implement this in Shell script.
|
by: spec |
last post by:
Hi all, I know nothing about Python. What I need to do is to get a
Python script to execute a local shell script. I do not need any
output. What would be th eeasiest way to accomplish this?
Thanks!
|
by: Chandra |
last post by:
Hi,
Is there a way to execute a python script(file) in ASP.NET application
(programmatically)??
Regards,
Chandra
| |
by: sohan |
last post by:
Hi,
I want to know how to connect and execute a db2 query from inside a
UNIX shell script.
Details: We have a unix shell script. We need to execute multiple db2
sql queries from this shell script and export the result to a file.
Any code snippet on this will be helpful.
|
by: brad |
last post by:
When I use idle or a shell to execute a python script, the script
executes in the directory it is currently in (in this case, my desktop).
However, when using GNOME and right clicking the py script and selecting
'open with python', the execution occurs in my home directory, not my
desktop.
Is there a way to force py scripts to always run within the directory
that they reside in?
Thanks
|
by: telduivel |
last post by:
Can someone please help me with this:
I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I would like for the python script to exit once the call has been made, without waiting for the shell script to finish.
My question is:
how do I call a shell script from a python script?
and how do I do that such that control is tranferred to the...
|
by: Samuel A. Falvo II |
last post by:
I have a shell script script.sh that launches a Java process in the
background using the &-operator, like so:
#!/bin/bash
java ... arguments here ... &
In my Python code, I want to invoke this shell script using the
Subprocess module. Here is my code:
def resultFromRunning_(command):
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |