GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

Art Kendall
A few months ago I created a file.  The output data file became mangled.  So I went back to the syntax and tried to
recreate the file.
Note I substituted ... for  specs that should not be posted.  They are character for character the same in the file handle and in the error message.

This worked before.  When I tried it now it came up with the error message below.  I rebooted and the same thing happened.
If I <file> <read text data> I can open it.  So I can work around temporarily.  But before I finish I need to have a complete audit trail

When it worked before I had the unpatched version 21. 64 bit.
Now I have 21.0.0.1

FILE HANDLE BOOK /name = 'C:\Users\Art\Documents\ ... .xlsx'.
GET DATA /TYPE=XLSX
   /FILE= BOOK
   /SHEET=name '1988'
   /CELLRANGE=full
   /READNAMES=on
   /ASSUMEDSTRWIDTH=32767.
EXECUTE.

GET DATA (2052) Error accessing the Excel file.  The file may be open by another application.  If so, close it and retry. * File: "C:\Users\Art\Documents\ ... .xlsx

This is a long set of syntax that reads each sheet 1988 1989 etc.  Each block reads a sheet and does  ALTER TYPEs to make  long string variables have the same width before I ADD FILES.


-- 
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

J. R. Carroll
Art,

I'll start with the (maybe not so) obvious stuff:

1.  Have you rebooted (if you have an excel process that is hung up in the back ground, a reboot will clear it for you).
2.  Do you see any excel threads if you look at your task manager?  (crtl+alt+del)
3.  Try opening up the excel document - doing a 'save as' and save it as another file name.  Close out the excel document and try running your syntax on the OLD file first (just as you have it now - does it work?)  If not adjust your syntax to point to the NEW file.  Try it.  Does it work?

As to what is causing that error message, it's system originated not SPSS.  Once the system gets an exclusive lock on the file, that message is commonly reported to ANY program that tries to access it.  I don't believe this is a problem with your syntax (unless you are trying to open/read/close/open/read in your syntax and you didn't post that!  If that's the case, and you are trying to read in multiple sheets lets say, I know in Python if you don't properly close the file object and try to have multiple threads read the file you can run into some problems - I mention python only because I use Python far more than I use SPSS... DM/JonoH can comment on how SPSS handles situations like that).


----


J. R. Carroll
Cell:  (650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 9:42 AM, Art Kendall <[hidden email]> wrote:
A few months ago I created a file.  The output data file became mangled.  So I went back to the syntax and tried to
recreate the file.
Note I substituted ... for  specs that should not be posted.  They are character for character the same in the file handle and in the error message.

This worked before.  When I tried it now it came up with the error message below.  I rebooted and the same thing happened.
If I <file> <read text data> I can open it.  So I can work around temporarily.  But before I finish I need to have a complete audit trail

When it worked before I had the unpatched version 21. 64 bit.
Now I have 21.0.0.1

FILE HANDLE BOOK /name = 'C:\Users\Art\Documents\ ... .xlsx'.
GET DATA /TYPE=XLSX
   /FILE= BOOK
   /SHEET=name '1988'
   /CELLRANGE=full
   /READNAMES=on
   /ASSUMEDSTRWIDTH=32767.
EXECUTE.

GET DATA (2052) Error accessing the Excel file.  The file may be open by another application.  If so, close it and retry. * File: "C:\Users\Art\Documents\ ... .xlsx

This is a long set of syntax that reads each sheet 1988 1989 etc.  Each block reads a sheet and does  ALTER TYPEs to make  long string variables have the same width before I ADD FILES.


--
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants


View this message in context: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

Art Kendall
Reboots did not work.
Restarts did not work.

I found nothing under task manager.

what did work was to move the file to another location c:\project\
so that that file handle was 1) shorter and 2) had no embedded spaces.  e.g.,  \ spss input\
!!

I don't have time now to tease out whether it was the long file spec and/or the embedded spaces.

It still seems odd that a syntax file that worked in August 2012 did not work  in May 2013.
When I get time I'll go back and see if i installed SPSS 21 (not Beta) after August .
Art Kendall
Social Research Consultants
On 5/4/2013 9:54 AM, J. R. Carroll [via SPSSX Discussion] wrote:
Art,

I'll start with the (maybe not so) obvious stuff:

1.  Have you rebooted (if you have an excel process that is hung up in the back ground, a reboot will clear it for you).
2.  Do you see any excel threads if you look at your task manager?  (crtl+alt+del)
3.  Try opening up the excel document - doing a 'save as' and save it as another file name.  Close out the excel document and try running your syntax on the OLD file first (just as you have it now - does it work?)  If not adjust your syntax to point to the NEW file.  Try it.  Does it work?

As to what is causing that error message, it's system originated not SPSS.  Once the system gets an exclusive lock on the file, that message is commonly reported to ANY program that tries to access it.  I don't believe this is a problem with your syntax (unless you are trying to open/read/close/open/read in your syntax and you didn't post that!  If that's the case, and you are trying to read in multiple sheets lets say, I know in Python if you don't properly close the file object and try to have multiple threads read the file you can run into some problems - I mention python only because I use Python far more than I use SPSS... DM/JonoH can comment on how SPSS handles situations like that).


----


J. R. Carroll
Cell:  (650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 9:42 AM, Art Kendall <[hidden email]> wrote:
A few months ago I created a file.  The output data file became mangled.  So I went back to the syntax and tried to
recreate the file.
Note I substituted ... for  specs that should not be posted.  They are character for character the same in the file handle and in the error message.

This worked before.  When I tried it now it came up with the error message below.  I rebooted and the same thing happened.
If I <file> <read text data> I can open it.  So I can work around temporarily.  But before I finish I need to have a complete audit trail

When it worked before I had the unpatched version 21. 64 bit.
Now I have 21.0.0.1

FILE HANDLE BOOK /name = 'C:\Users\Art\Documents\ ... .xlsx'.
GET DATA /TYPE=XLSX
   /FILE= BOOK
   /SHEET=name '1988'
   /CELLRANGE=full
   /READNAMES=on
   /ASSUMEDSTRWIDTH=32767.
EXECUTE.

GET DATA (2052) Error accessing the Excel file.  The file may be open by another application.  If so, close it and retry. * File: "C:\Users\Art\Documents\ ... .xlsx

This is a long set of syntax that reads each sheet 1988 1989 etc.  Each block reads a sheet and does  ALTER TYPEs to make  long string variables have the same width before I ADD FILES.


--
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants


View this message in context: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.
Sent from the SPSSX Discussion mailing list archive at Nabble.com.




To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

J. R. Carroll
Art,

I don't have time now to tease out whether it was the long file spec and/or the embedded spaces.

Unfortunately, even if you had time, I don't think it would be fruitful for you...  if a long file path or embedded spaces were the problem (as you suspect) SPSS wouldn't have reported "I found the file, but I can't open it because you have it open somewhere else".  It would have said "I can't find the file"; aka extra spaces don't throw errors about an i/o thread holding an exclusive lock on to a file object.  Which means that it's NOT syntax bound.  

But I'm glad it's working for you.  


----


J. R. Carroll
Cell:  (650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 3:06 PM, Art Kendall <[hidden email]> wrote:
Reboots did not work.
Restarts did not work.

I found nothing under task manager.

what did work was to move the file to another location c:\project\
so that that file handle was 1) shorter and 2) had no embedded spaces.  e.g.,  \ spss input\
!!

I don't have time now to tease out whether it was the long file spec and/or the embedded spaces.

It still seems odd that a syntax file that worked in August 2012 did not work  in May 2013.
When I get time I'll go back and see if i installed SPSS 21 (not Beta) after August .

Art Kendall
Social Research Consultants
On 5/4/2013 9:54 AM, J. R. Carroll [via SPSSX Discussion] wrote:
Art,

I'll start with the (maybe not so) obvious stuff:

1.  Have you rebooted (if you have an excel process that is hung up in the back ground, a reboot will clear it for you).
2.  Do you see any excel threads if you look at your task manager?  (crtl+alt+del)
3.  Try opening up the excel document - doing a 'save as' and save it as another file name.  Close out the excel document and try running your syntax on the OLD file first (just as you have it now - does it work?)  If not adjust your syntax to point to the NEW file.  Try it.  Does it work?

As to what is causing that error message, it's system originated not SPSS.  Once the system gets an exclusive lock on the file, that message is commonly reported to ANY program that tries to access it.  I don't believe this is a problem with your syntax (unless you are trying to open/read/close/open/read in your syntax and you didn't post that!  If that's the case, and you are trying to read in multiple sheets lets say, I know in Python if you don't properly close the file object and try to have multiple threads read the file you can run into some problems - I mention python only because I use Python far more than I use SPSS... DM/JonoH can comment on how SPSS handles situations like that).


----


J. R. Carroll
Cell:  <a href="tel:%28650%29%20776-6613" value="+16507766613" target="_blank">(650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 9:42 AM, Art Kendall <[hidden email]> wrote:
A few months ago I created a file.  The output data file became mangled.  So I went back to the syntax and tried to
recreate the file.
Note I substituted ... for  specs that should not be posted.  They are character for character the same in the file handle and in the error message.

This worked before.  When I tried it now it came up with the error message below.  I rebooted and the same thing happened.
If I <file> <read text data> I can open it.  So I can work around temporarily.  But before I finish I need to have a complete audit trail

When it worked before I had the unpatched version 21. 64 bit.
Now I have 21.0.0.1

FILE HANDLE BOOK /name = 'C:\Users\Art\Documents\ ... .xlsx'.
GET DATA /TYPE=XLSX
   /FILE= BOOK
   /SHEET=name '1988'
   /CELLRANGE=full
   /READNAMES=on
   /ASSUMEDSTRWIDTH=32767.
EXECUTE.

GET DATA (2052) Error accessing the Excel file.  The file may be open by another application.  If so, close it and retry. * File: "C:\Users\Art\Documents\ ... .xlsx

This is a long set of syntax that reads each sheet 1988 1989 etc.  Each block reads a sheet and does  ALTER TYPEs to make  long string variables have the same width before I ADD FILES.


--
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants


View this message in context: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.
Sent from the SPSSX Discussion mailing list archive at Nabble.com.




To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants


View this message in context: Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

Art Kendall
Yes exactly why I did not want to take the time to refine the workaround. 
It may be the OS or the way SPSS sends a command to the OS or some weird combination of OS and SPSS etc.
Total length of the filespec? Depth of the folder tree?
Difference between how
FILE HANDLE   ==> GET DATA ==> OS
 and
<FILE> <Read Text Data> ==> OS
works.

or even between how

FILE HANDLE   ==> GET DATA /TYPE = XLSX ==> OS
and
<FILE> <Read Text Data> ==> OS
works.
Art Kendall
Social Research Consultants
On 5/4/2013 6:41 PM, J. R. Carroll [via SPSSX Discussion] wrote:
Art,

I don't have time now to tease out whether it was the long file spec and/or the embedded spaces.

Unfortunately, even if you had time, I don't think it would be fruitful for you...  if a long file path or embedded spaces were the problem (as you suspect) SPSS wouldn't have reported "I found the file, but I can't open it because you have it open somewhere else".  It would have said "I can't find the file"; aka extra spaces don't throw errors about an i/o thread holding an exclusive lock on to a file object.  Which means that it's NOT syntax bound.  

But I'm glad it's working for you.  


----


J. R. Carroll
Cell:  (650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 3:06 PM, Art Kendall <[hidden email]> wrote:
Reboots did not work.
Restarts did not work.

I found nothing under task manager.

what did work was to move the file to another location c:\project\
so that that file handle was 1) shorter and 2) had no embedded spaces.  e.g.,  \ spss input\
!!

I don't have time now to tease out whether it was the long file spec and/or the embedded spaces.

It still seems odd that a syntax file that worked in August 2012 did not work  in May 2013.
When I get time I'll go back and see if i installed SPSS 21 (not Beta) after August .

Art Kendall
Social Research Consultants
On 5/4/2013 9:54 AM, J. R. Carroll [via SPSSX Discussion] wrote:
Art,

I'll start with the (maybe not so) obvious stuff:

1.  Have you rebooted (if you have an excel process that is hung up in the back ground, a reboot will clear it for you).
2.  Do you see any excel threads if you look at your task manager?  (crtl+alt+del)
3.  Try opening up the excel document - doing a 'save as' and save it as another file name.  Close out the excel document and try running your syntax on the OLD file first (just as you have it now - does it work?)  If not adjust your syntax to point to the NEW file.  Try it.  Does it work?

As to what is causing that error message, it's system originated not SPSS.  Once the system gets an exclusive lock on the file, that message is commonly reported to ANY program that tries to access it.  I don't believe this is a problem with your syntax (unless you are trying to open/read/close/open/read in your syntax and you didn't post that!  If that's the case, and you are trying to read in multiple sheets lets say, I know in Python if you don't properly close the file object and try to have multiple threads read the file you can run into some problems - I mention python only because I use Python far more than I use SPSS... DM/JonoH can comment on how SPSS handles situations like that).


----


J. R. Carroll
Cell:  <a href="tel:%28650%29%20776-6613" value="+16507766613" target="_blank">(650) 776-6613
          [hidden email]
          [hidden email]



On Sat, May 4, 2013 at 9:42 AM, Art Kendall <[hidden email]> wrote:
A few months ago I created a file.  The output data file became mangled.  So I went back to the syntax and tried to
recreate the file.
Note I substituted ... for  specs that should not be posted.  They are character for character the same in the file handle and in the error message.

This worked before.  When I tried it now it came up with the error message below.  I rebooted and the same thing happened.
If I <file> <read text data> I can open it.  So I can work around temporarily.  But before I finish I need to have a complete audit trail

When it worked before I had the unpatched version 21. 64 bit.
Now I have 21.0.0.1

FILE HANDLE BOOK /name = 'C:\Users\Art\Documents\ ... .xlsx'.
GET DATA /TYPE=XLSX
   /FILE= BOOK
   /SHEET=name '1988'
   /CELLRANGE=full
   /READNAMES=on
   /ASSUMEDSTRWIDTH=32767.
EXECUTE.

GET DATA (2052) Error accessing the Excel file.  The file may be open by another application.  If so, close it and retry. * File: "C:\Users\Art\Documents\ ... .xlsx

This is a long set of syntax that reads each sheet 1988 1989 etc.  Each block reads a sheet and does  ALTER TYPEs to make  long string variables have the same width before I ADD FILES.


--
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants


View this message in context: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.
Sent from the SPSSX Discussion mailing list archive at Nabble.com.




To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants


View this message in context: Re: GET DATA (2052) Error accessing the Excel file. The file may be open by another application. If so, close it and retry.

Sent from the SPSSX Discussion mailing list archive at Nabble.com.




To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants