Python Traceback: no error, yet no output from script
Question: `enter code here`Im using Eclipse with PyDev and trying to get a simple script
working:

Edited Code:

    
    
    import time
    import os
    import json
    import tarfile
    source_config='/Users/brendanryan/scripting/brendan.json'
    backup_dir = '/myapp/target/'
    
    def main():
    
            with open(source_config) as f:
                    data = json.load(f)
                    for entry in data["source_include"]:
                        #base_filename = os.path.basename(entry)
                        #source_dirs = [ name for name in os.listdir(entry) if os.path.isdir(os.path.join(entry, name)) ]
                        full_dir = os.path.join(entry)
                        tar = tarfile.open(os.path.join(backup_dir, '.tar.gzip'), 'w:gz')
                        tar.add(full_dir)
                        tar.close()
    
    if __name__ == '__main__':
            main()
    

JSON:

    
    
    {
        "source_type": "folder",
        "tar_type": "gzip",
        "tar_max_age": "10",
        "source_include": ["/myapp/conf", "/myapp/db"],
        "target_path": "/myapp/target"
    }
    

This is SUPPOSED to work. But it doesnt. When the code was broken, I had all
sorts of Tracebacks to work with... and I DO mean all. Now, I just get ""...
no errors, no output, no resulting .tar.gz, no nothing when I run it. Id be
willing to try ANYTHING to get this to work right now...

For the uninitiated, this is supposed to read the json (which are variables)
and use that to select the source folders, then tar.gz them and place the
resulting archives in another folder. I dont know how to do it, but it would
be great to actually just take ALL the folders in the "source_include", tar.gz
and name it with the current date. That would be AWESOME!

Edit: Added main()... THANKS! So, with the edit, the traceback is now:

Edit AGAIN: And NOW, no traceback. Again. No output...

Foul language is gone (Eclipse says the code is cool now)... but no output. Al
all, as in no reslutant archive. Back to square one.


Answer: You don't actually seem to be calling the `main` function at all. To call a
function, you need to use parentheses: `main()`.

(And you shouldn't catch an exception if all you're going to do is print a
useless canned message. Better to let the exception propagate so you can see
what's actually going wrong.)

