Sponsored Content
Top Forums Programming Python tar script; no errors; no output Post 302925177 by bash_in_my_head on Friday 14th of November 2014 12:29:04 PM
Old 11-14-2014
Python tar script; no errors; no output

This script produces no errors. It also does not produce an output file. Any ideas?

Code:
#!/usr/bin/python

import tarfile

output_filename = 'etc.tar'
source_dir = '/etc/'

#To build a .tar.gz for an entire directory tree:

def make_tarfile(output_filename, source_dir):
    with tarfile.open(output_filename, "w:gz") as tar:
        tar.add(source_dir, arcname=os.path.basename(source_dir))

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

redirecting output, including errors

what's the proper syntax to redirect output, including all errors? ls -la > direct.list makes out put file direct.list but if i'm running a script and i want to include the errors, would i type something like: myscript.scr 2> out_list.txt or will that get the errors only? (1 Reply)
Discussion started by: kymberm
1 Replies

2. Programming

popen catching output and errors

I have code which at the moment only catches the command/program output if the program runs correctly, which is a small problem as I would like to capture everything from stdout inclusive of errors FILE *fp; fp = popen(command.c_str(), "r"); while(fgets(cbuf, 1024, fp) != NULL){ .....do stuff... (1 Reply)
Discussion started by: mshindo
1 Replies

3. Solaris

Error in installing the mysql-python-1.2.3.tar.gz

Hi, I followed the step written in README. It got some error message when I type " #python setup.py build" running build running build_py copying MySQLdb/release.py -> build/lib.solaris-2.11-i86pc-2.4/MySQLdb running build_ext building '_mysql' extension /usr/lib/python2.4/pycc -DNDEBUG... (2 Replies)
Discussion started by: AlexCheung
2 Replies

4. HP-UX

errors from output /usr/bin/last

for ga016dgf -> /usr/bin/last | cut -c1-3 Invalid record size. Unable to continue ... any ideas? running on ga016dgf -> uname -a HP-UX ga016dgf B.11.31 U ia64 1246079591 unlimited-user license thank you. Video tutorial on how to use code tags in The UNIX and Linux Forums. (4 Replies)
Discussion started by: Bill L.
4 Replies

5. Shell Programming and Scripting

Plot python script output to file

Hi all, I`m trying to generate some plots using a python package named splicegrapher. I have access to a cluster which does not allow X11 forwarding and as a result I get RuntimeError: could not open display error when I use one of the plotting scripts (attached). How do I modify the script... (1 Reply)
Discussion started by: newbie83
1 Replies

6. Ubuntu

What is solution for this error "tar: Exiting with failure status due to previous errors"?

Does anyone know what is solution for this error ?tar: Exiting with failure status due to previous errors from last 3 days I am trying to take backup of home/user directory getting again and again same error please anyone give me solution (8 Replies)
Discussion started by: Akshay Hegde
8 Replies

7. HP-UX

Suppressing errors from command output

Hi, When I run the command "print_manifest | grep "Main Memory", I get the note : # /opt/ignite/bin/print_manifest | grep "Main Memory" NOTE: Could not read the /etc/resolv.conf file. Main Memory: 196498 MB # How do I suppress the part : NOTE: Could not read the... (4 Replies)
Discussion started by: anaigini45
4 Replies

8. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

9. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies

10. Programming

Python script to run multiple command and append data in output csv file

Experts, I am writing a script and able to write only small piece of code and not able to collect logic to complete this task. In input file have to look for name like like this (BGL_HSR_901_1AG_A_CR9KTR10) before sh iss neors. Record this (BGL_HSR_901_1AG_A_CR9KTR10) in csv file Now have to... (0 Replies)
Discussion started by: as7951
0 Replies
Songwrite(1)															      Songwrite(1)

NAME
Songwrite - A tablature editor SYNTAX
songwrite [<filename...>] songwrite --help songwrite --version songwrite --play [<filename...>] songwrite --playloop [<filename...>] songwrite --songbook <songbook_title> <song_filenames...> songwrite --convert <format> [--output <output_filename>] <filename> DESCRIPTION
Songwrite is a tablature (guitar partition) editor, with playing and printing ability. Songwrite is coded in Python and uses Tk (Tkinter); it relies on Timidity to play midi and on GNU Lilypond for printing. OPTIONS
--help Output help information and exit. --version Output version information and exit. --play <filename> Play <filename> and exit. --playloop <filename> Play <filename> in loop (stop it with C-c or kill). --songbook <songbook_filename> <songbook_title> <song_filenames...> Create a postcript songbook with the given title and songs. --convert <format> [--output <output_filename>] <filename> Opens no window, and converts Songwrite file <filename> into <format>. <format> is one of: lilypond, latex, ps, asciitab, midi. <output_filename> is deduced from <filename> and <format> if not given. Several --convert can be given. Use --output - for STDOUT (not available for ps). FILES
~/.songwrite AUTHORS
Jiba (Lamy Jean-Baptiste) <jiba@tuxfamily.org> Jiba (Lamy Jean-Baptiste) 0.10 Songwrite(1)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy