![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 1
Rep Power: 0
![]() |
shutil.copy corrupting files?
Hi,
Has anyone here ever come across the shutil copy method corrupting files (on Linux)? I've just finished writing my first Python script for use to help me automate an installation process I have to do fairly regularly, but it is giving me some grief! The script basically copies some files into a virtual site on a server for use in an eCommerce application and does the following: 1 - lets me select the site for the installation 2 - connects via FTP to a server that holds the required files - using the ftplib module and the FTP class 3 - downloads a text-file containing a list of the files and the desired destination paths for these files. This text file is parsed and the required files are downloaded to a temp location. Any destination paths that don't already exist are created in the virtual site's filesystem using os.makedir 4 - the files are then copied from the temp location into the virtual site using shutil.copy 5 - finally the correct ownerships and permissions are applied to the new files. 6 - the software installation is then completed manually through a browser (using the eCommerce software) Unfortunately, when I come to add the software to the site using the eComm software, they are causing internal server errors on the web server (giving "premature end of script headers" in the error logs - something I usually see from corrupt scripts). I know the files are ok to begin with, as going through the above process manually does not cause the web server to choke. At first I assumed the FTP transfer must have been trashing the files, so I tried commenting that part out of the script and just copying local versions of the files into the website using shutil.copy instead. This didn't help. It looks to me like shutil.copy is the culprit. I'd love to know if anyone else has come across this, I haven't been able to find anything while googling though, so it doesn't look too hopeful. Does anyone have any tips on how else I could find what's causing the trouble? Interstingly, when I compare the source files to my copies, they have exactly the same filesizes. Unfortunately, they are data files, so I can't view the contents to look for problems. Thanks in advance, Tim |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|