• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1840)  |  Call(1767)  |  Derive(0)  |  Import(73)
Copy data from src to dst

        def copyfile(src, dst):
    """Copy data from src to dst"""
    if _samefile(src, dst):
        raise Error("`%s` and `%s` are the same file" % (src, dst))

    for fn in [src, dst]:
        try:
            st = os.stat(fn)
        except OSError:
            # File most likely does not exist
            pass
        else:
            # XXX What about other special files? (sockets, devices...)
            if stat.S_ISFIFO(st.st_mode):
                raise SpecialFileError("`%s` is a named pipe" % fn)

    with open(src, 'rb') as fsrc:
        with open(dst, 'wb') as fdst:
            copyfileobj(fsrc, fdst)
        


src/p/y/pymacadmin-HEAD/utilities/diskimage_unittesting/tests/example_plist_test.py   pymacadmin(Download)
  def setUp(self):
    """copy the original file to a temp plist and convert it to xml1."""
    self.tempdir = tempfile.mkdtemp()
    self.orig_imageinfo_file = os.path.join(self.mountpoint, imageinfo_plist)
    imageinfo_file = os.path.join(self.tempdir, "imageinfo.plist")
    shutil.copyfile(self.orig_imageinfo_file, imageinfo_file)
    command = ["plutil", "-convert", "xml1", imageinfo_file]

src/m/a/matplotlib-HEAD/py4science/examples/sphinx_template/sphinxext/plot_directive.py   matplotlib(Download)
    all_exists = True
 
    if basedir != outdir:
        shutil.copyfile(fullpath, os.path.join(outdir, fname))
 
    for format, dpi in formats:
        outname = os.path.join(outdir, '%s.%s' % (basename, format))

src/p/y/pygccxml-HEAD/pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py   pygccxml(Download)
    def write_files( self, mb ):
        mb.split_module( date_time_settings.generated_files_dir )
        shutil.copyfile( os.path.join( date_time_settings.date_time_pypp_include, 'date_time_wrapper.hpp' )
                         , os.path.join( date_time_settings.generated_files_dir, 'date_time_wrapper.hpp' ) )
 
    def create(self):
        start_time = time.clock()      

src/n/o/notmm-0.4.1/examples/lib/satchmo_store/shop/management/commands/satchmo_copy_urls.py   notmm(Download)
    def handle_noargs(self, **options):
        import satchmo_store
        url_src = os.path.join(satchmo_store.__path__[0],'urls.py')
        url_dest = os.path.join(os.getcwd(), 'satchmo-urls.py')
        shutil.copyfile(url_src, url_dest)
        print "Copied %s to %s" % (url_src, url_dest)
 

src/d/j/djpcms-0.8/examples/djpcms-site/docs/source/_ext/djpcmsdoc.py   djpcms(Download)
 
        # copy the environment file from the doctree dir to the output dir
        # as needed by the web app
        shutil.copyfile(path.join(self.doctreedir, builders.ENV_PICKLE_FILENAME),
                        path.join(self.outdir, builders.ENV_PICKLE_FILENAME))
 
        # touch 'last build' file, used by the web application to determine

src/p/y/pyid3-HEAD/test/test_samples240.py   pyid3(Download)
            print tag_file
            tag_file = os.path.join(mydir, tag_file)
            tfn = tempfile.mktemp('id3v2.tag')
            shutil.copyfile(tag_file, tfn)
 
            try:
                tag = id3.ID3v2(tfn)

src/p/y/pyid3-HEAD/test/test_samples230.py   pyid3(Download)
        for fn in tag_list:
            tag_file = os.path.join(mydir, fn)
            tfn = tempfile.mktemp('id3v2.tag')
            shutil.copyfile(tag_file, tfn)
 
            try:
                tag = id3.ID3v2(tfn)

src/o/p/opengrasp-HEAD/trunk/OpenRAVE_Modified/python/examples/inversekinematics.py   opengrasp(Download)
           output_dir = self.myrelpath('/',os.getcwd())
 
        platformsourcefilename = os.path.splitext(output_filename)[0]+'.cpp' # needed in order to prevent interference with machines with different architectures 
        shutil.copyfile(sourcefilename, platformsourcefilename)
        try:
            objectfiles = compiler.compile(sources=[platformsourcefilename],macros=[('IKFAST_CLIBRARY',1)],extra_postargs=compile_flags,output_dir=output_dir)
            compiler.link_shared_object(objectfiles,output_filename=output_filename)

src/o/p/opengrasp-HEAD/OpenRAVE_Modified/python/examples/inversekinematics.py   opengrasp(Download)
           output_dir = self.myrelpath('/',os.getcwd())
 
        platformsourcefilename = os.path.splitext(output_filename)[0]+'.cpp' # needed in order to prevent interference with machines with different architectures 
        shutil.copyfile(sourcefilename, platformsourcefilename)
        try:
            objectfiles = compiler.compile(sources=[platformsourcefilename],macros=[('IKFAST_CLIBRARY',1)],extra_postargs=compile_flags,output_dir=output_dir)
            compiler.link_shared_object(objectfiles,output_filename=output_filename)

src/d/j/django-pluggables-0.1.5/examples/sillywalks/settings.py   django-pluggables(Download)
db_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'db'))
DATABASE_NAME = os.path.join(db_root, '.database.db')
if not os.path.exists(DATABASE_NAME) and os.path.exists(os.path.join(db_root, 'database.db')):
    shutil.copyfile(os.path.join(db_root, 'database.db'), DATABASE_NAME)
DATABASE_ENGINE = 'sqlite3'
DATABASE_USER = ''
DATABASE_PASSWORD = ''

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next