|
Okay - Im trying to keep things in perspective and be patient. I would
think this is about as simple as it can get - granted a large number of files - but they are small and this should be NO big deal. The following python script simply opens an excel file, makes a limited number of calcs and saves as spss 'sav' file. Now, why is it I cant get through this without SPSS CRASHING? One time it will go through without errors or problems of any kind - hurray! - the next time I get through 10 files - Crash - the next time 300 files - Crash - the next time 700 files CRASH - the next time 200 files - CRASH - the next time all the way through again .. etc - there seems to be no rhyme or reason why or where it crashes - but it does get through it 1 out 10+/- times - BUT I CANT keep re-running this till by odd chance it gets happens to get through it ... ANY SUGGESTIONS? All data is local, the machine is higher end (specs below). It is running version 14 and XPPro all with updates ***** PROGRAM BLOCK . BEGIN PROGRAM PYTHON. import os #help (os) import sys #help (sys) import spss #help (spss) from spss import Submit inpath = "I:\\...\\RecExcel\\" <<< edited - dont worry about this #print inpath outpath = "I:\\...\\ConSPSS\\" <<< edited - dont worry about this #print outpath savext = ".sav" #print savext #Need variable to hold all excel filenames within 'inpath' directory ExclFilesT = os.listdir(inpath) ExclFiles = sorted(ExclFilesT) #print ExclFiles #Iterate over the filenames opening, modifying, saving to 'outpath' directory try: fleindx=0 for infle in ExclFiles: fleindx=fleindx + 1 outfle= outpath + infle[0:-4] + savext Submit(r""" GET DATA /TYPE = XLS /FILE = '%s' /CELLRANGE= full /READNAMES= on /ASSUMEDSTRWIDTH=32767 . FORMAT starttime endtime (F6.2). COUNT x=endtime (0.001 THRU HI). SEL IF (x>0). STRING flename (A254). COMPUTE flename ='%s'. COMPUTE fleno=%d. COMPUTE ordnfle=$casenum. STRING tim_event (A12). COMPUTE tim_event=event. EXECUTE. SAVE OUTFILE= '%s' /KEEP flename fleno ordnfle starttime endtime tim_event . """ %(inpath + infle, infle[0:-4], fleindx, outfle)) print "DONE:", infle, " >> ", outfle except: pass END PROGRAM. ***** END PROGRAM BLOCK . OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600 OS Manufacturer Microsoft Corporation System Name DRAGON System Manufacturer System manufacturer System Model System Product Name System Type X86-based PC Processor x86 Family 15 Model 4 Stepping 4 GenuineIntel ~3010 Mhz BIOS Version/Date American Megatrends Inc. 0206, 29/04/2005 SMBIOS Version 2.3 Windows Directory I:\WINDOWS System Directory I:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale Canada Hardware Abstraction Layer Version = "5.1.2600.5512 (xpsp.080413-2111)" User Name DRAGON\Tim1 Time Zone Eastern Daylight Time Total Physical Memory 4,096.00 MB Available Physical Memory 2.58 GB Total Virtual Memory 2.00 GB Available Virtual Memory 1.96 GB Page File Space 5.09 GB Page File I:\pagefile.sys Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
It looks like this logic is basically okay, but I don't see a check to make sure that you are only trying to read Excel files. I’d suggest using glob.glob(your-input-directory/*.xls) instead of os.listdir() to make sure that you are only reading Excel files.
Of course, it shouldn’t crash anyway, but we'd need more information to track that down. SPSS 14 is a long time ago, but I'm not aware of any problems that sound like this. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Thursday, July 03, 2008 6:21 PM To: [hidden email] Subject: [SPSSX-L] SPSS CRASH CRASH CRSAH Okay - Im trying to keep things in perspective and be patient. I would think this is about as simple as it can get - granted a large number of files - but they are small and this should be NO big deal. The following python script simply opens an excel file, makes a limited number of calcs and saves as spss 'sav' file. Now, why is it I cant get through this without SPSS CRASHING? One time it will go through without errors or problems of any kind - hurray! - the next time I get through 10 files - Crash - the next time 300 files - Crash - the next time 700 files CRASH - the next time 200 files - CRASH - the next time all the way through again .. etc - there seems to be no rhyme or reason why or where it crashes - but it does get through it 1 out 10+/- times - BUT I CANT keep re-running this till by odd chance it gets happens to get through it ... ANY SUGGESTIONS? All data is local, the machine is higher end (specs below). It is running version 14 and XPPro all with updates ***** PROGRAM BLOCK . BEGIN PROGRAM PYTHON. import os #help (os) import sys #help (sys) import spss #help (spss) from spss import Submit inpath = "I:\\...\\RecExcel\\" <<< edited - dont worry about this #print inpath outpath = "I:\\...\\ConSPSS\\" <<< edited - dont worry about this #print outpath savext = ".sav" #print savext #Need variable to hold all excel filenames within 'inpath' directory ExclFilesT = os.listdir(inpath) ExclFiles = sorted(ExclFilesT) #print ExclFiles #Iterate over the filenames opening, modifying, saving to 'outpath' directory try: fleindx=0 for infle in ExclFiles: fleindx=fleindx + 1 outfle= outpath + infle[0:-4] + savext Submit(r""" GET DATA /TYPE = XLS /FILE = '%s' /CELLRANGE= full /READNAMES= on /ASSUMEDSTRWIDTH=32767 . FORMAT starttime endtime (F6.2). COUNT x=endtime (0.001 THRU HI). SEL IF (x>0). STRING flename (A254). COMPUTE flename ='%s'. COMPUTE fleno=%d. COMPUTE ordnfle=$casenum. STRING tim_event (A12). COMPUTE tim_event=event. EXECUTE. SAVE OUTFILE= '%s' /KEEP flename fleno ordnfle starttime endtime tim_event . """ %(inpath + infle, infle[0:-4], fleindx, outfle)) print "DONE:", infle, " >> ", outfle except: pass END PROGRAM. ***** END PROGRAM BLOCK . OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600 OS Manufacturer Microsoft Corporation System Name DRAGON System Manufacturer System manufacturer System Model System Product Name System Type X86-based PC Processor x86 Family 15 Model 4 Stepping 4 GenuineIntel ~3010 Mhz BIOS Version/Date American Megatrends Inc. 0206, 29/04/2005 SMBIOS Version 2.3 Windows Directory I:\WINDOWS System Directory I:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale Canada Hardware Abstraction Layer Version = "5.1.2600.5512 (xpsp.080413-2111)" User Name DRAGON\Tim1 Time Zone Eastern Daylight Time Total Physical Memory 4,096.00 MB Available Physical Memory 2.58 GB Total Virtual Memory 2.00 GB Available Virtual Memory 1.96 GB Page File Space 5.09 GB Page File I:\pagefile.sys Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Tim AT Home
Hi,
This sounds suspiciously like you may have a problem with a bad memory chip/system RAM etc. If Jon's suggestion does not solve the crashing, you could try a system check. HTH Mike -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Thursday, July 03, 2008 8:21 PM To: [hidden email] Subject: SPSS CRASH CRASH CRSAH Okay - Im trying to keep things in perspective and be patient. I would think this is about as simple as it can get - granted a large number of files - but they are small and this should be NO big deal. The following python script simply opens an excel file, makes a limited number of calcs and saves as spss 'sav' file. Now, why is it I cant get through this without SPSS CRASHING? One time it will go through without errors or problems of any kind - hurray! - the next time I get through 10 files - Crash - the next time 300 files - Crash - the next time 700 files CRASH - the next time 200 files - CRASH - the next time all the way through again .. etc - there seems to be no rhyme or reason why or where it crashes - but it does get through it 1 out 10+/- times - BUT I CANT keep re-running this till by odd chance it gets happens to get through it ... ANY SUGGESTIONS? All data is local, the machine is higher end (specs below). It is running version 14 and XPPro all with updates ***** PROGRAM BLOCK . BEGIN PROGRAM PYTHON. import os #help (os) import sys #help (sys) import spss #help (spss) from spss import Submit inpath = "I:\\...\\RecExcel\\" <<< edited - dont worry about this #print inpath outpath = "I:\\...\\ConSPSS\\" <<< edited - dont worry about this #print outpath savext = ".sav" #print savext #Need variable to hold all excel filenames within 'inpath' directory ExclFilesT = os.listdir(inpath) ExclFiles = sorted(ExclFilesT) #print ExclFiles #Iterate over the filenames opening, modifying, saving to 'outpath' directory try: fleindx=0 for infle in ExclFiles: fleindx=fleindx + 1 outfle= outpath + infle[0:-4] + savext Submit(r""" GET DATA /TYPE = XLS /FILE = '%s' /CELLRANGE= full /READNAMES= on /ASSUMEDSTRWIDTH=32767 . FORMAT starttime endtime (F6.2). COUNT x=endtime (0.001 THRU HI). SEL IF (x>0). STRING flename (A254). COMPUTE flename ='%s'. COMPUTE fleno=%d. COMPUTE ordnfle=$casenum. STRING tim_event (A12). COMPUTE tim_event=event. EXECUTE. SAVE OUTFILE= '%s' /KEEP flename fleno ordnfle starttime endtime tim_event . """ %(inpath + infle, infle[0:-4], fleindx, outfle)) print "DONE:", infle, " >> ", outfle except: pass END PROGRAM. ***** END PROGRAM BLOCK . OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600 OS Manufacturer Microsoft Corporation System Name DRAGON System Manufacturer System manufacturer System Model System Product Name System Type X86-based PC Processor x86 Family 15 Model 4 Stepping 4 GenuineIntel ~3010 Mhz BIOS Version/Date American Megatrends Inc. 0206, 29/04/2005 SMBIOS Version 2.3 Windows Directory I:\WINDOWS System Directory I:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale Canada Hardware Abstraction Layer Version = "5.1.2600.5512 (xpsp.080413-2111)" User Name DRAGON\Tim1 Time Zone Eastern Daylight Time Total Physical Memory 4,096.00 MB Available Physical Memory 2.58 GB Total Virtual Memory 2.00 GB Available Virtual Memory 1.96 GB Page File Space 5.09 GB Page File I:\pagefile.sys Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of transmissions. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
