0
votes
2answers
27 views

Connections outlive SocketServer.TCPServer?

How can I make a TCP server properly close sockets? I wrote a simple TCP server to echo some information back to client. Now I would like to use it on localhost:8088 and stop it using killall and ...
-1
votes
2answers
26 views

Taking a file list using os.system(ls -1) and write it in a file in python

#opening a 'Newfile' to write in {file_list=open('file_list.txt','w')} #taking the list of file which i have to write in file {list_files = os.system("ls -1 ...
2
votes
3answers
30 views

adding attachment using sendmail from unix

I am using the following code to send email from unix. Code #!/usr/bin/python import os def sendMail(): sendmail_location = "/usr/sbin/sendmail" # sendmail location p = os.popen("%s -t" % ...
-1
votes
1answer
26 views

Fetching the output of a command executed through os.system() command

I am using a script where I issue a shell command to a remote server (ssh) using os.system() command. I need to collect the output of the command I executed on the remote server. The problem is the ...
0
votes
1answer
28 views

String formatting throwing error - python

I find the behaviour strange. My code works in Eclipse-Pydev , but doesn't work in Unix . Can someone please advise wehere I am going wrong? Code #!/usr/bin/python def ...
0
votes
1answer
28 views

Python FTP from UNIX to Windows

Hi I am running a pyython script on unix server. My aim is to take the file from unix server and put it in windows machine . #!/usr/bin/python import ftplib filename = "filename" ftp = ...
0
votes
3answers
49 views

Edit a text file by starting each line with TO

I'm attempting to use sed to edit a text file. The text file is actually an sms text message that was sent to my email in a .txt format, but the formatting is not pretty. Thanks in advance for any ...
0
votes
1answer
45 views

Python redirect input to child process

Normally this isn't much of an issue as passing data through STDIN/STDOUT is straightforward. But I am working on a diff util, and this has two inputs and one output. Consider: diff <(curl ...
0
votes
1answer
36 views

Accesing UNIX variable path in Python

I want to access a file present in a certain location in UNIX box. Usually I use Path $HOME/my/path/filename I am pusuing the following python code #!/usr/bin/python import time mytime= ...
2
votes
2answers
87 views

Efficient way to split files based on size

I do splitting of my zipped input file which is of 10 GB normally as follows, zcat file|split -b 1024m - file.part The above command will create 10 split files for 10 GB input. Here comes my ...
0
votes
3answers
37 views

Simulate database structure

I'm working on a script that is renaming most of the folders in my database. Material is so sensitive that I really don't like the idea of playing around with the script in the original database. I ...
0
votes
0answers
16 views

Python truncate active log file up to a certain line number w/o changing the iNode

I am trying to make an archiving framework for pruduction logs in my environment using python. I allready have the part with archiving done and I am now trying to solve truncating the file inplace ...
0
votes
4answers
39 views

Next line escape character not working python

I used the following code to read from a text file line by line and print it on screen. with open("source.txt") as f: content = f.readlines() print(content) print('\n') f.close() But ...
0
votes
2answers
52 views

How to return a value from a shell script in a python script

I have a python script which requires a value from a shell script. Following is the shell script (a.sh): #!/bin/bash return_value(){ value=$(///some unix command) echo "$value" } return_value ...
0
votes
1answer
16 views

curl subprocess data in header

In python I am running a curl command subprocess.check_output('curl ...') and the process returns data in the header (not body), how can I capture this using subprocess? curl ... > file ...

1 2 3 4 5 32
15 30 50 per page