OK, so you're doing something like this to copy the files:
begin program python.
import os
import shutil
import spss
in_dir="/Users/SPSS/tmp/in"
out_dir="/Users/SPSS/tmp/out"
for file_name in os.listdir(in_dir):
source = in_dir + "/" + file_name
destination = out_dir + "/" + file_name
if os.path.isfile(source):
shutil.copy(source, destination)
print('copied', file_name)
##spss.Submit("GET DATA etc") ??
end program.
Except that, after the copy, you are submitting an
spss.Submit(cmd) that opens each file with GET DATA, and some of those are failing?
------------------------------
Rick Marcantonio
Quality Assurance
IBM
------------------------------
Original Message:
Sent: Fri February 03, 2023 01:00 PM
From: Art Jack
Subject: Python Copies Not Opening in SPSS
Hi Rick, I have a set of csv's that I'm copying over from one directory to another with Python. But when i try to open them using the standard get data for xlsx or csv it's giving me an error in spss. When i open the document manually & close it, not editing it at all, I'm then able to open it in SPSS?
------------------------------
Art Jack
Original Message:
Sent: Fri February 03, 2023 12:08 PM
From: Rick Marcantonio
Subject: Python Copies Not Opening in SPSS
Hi. I'm not sure what you mean.
You are attempting to open a series of CSV files (using a GET DATA command I presume), and some of them are failing?
Where is the error coming from - Python or SPSS?
------------------------------
Rick Marcantonio
Quality Assurance
IBM
Original Message:
Sent: Fri February 03, 2023 10:52 AM
From: Art Jack
Subject: Python Copies Not Opening in SPSS
Morning, I have a split file set of csv's that i'm copying into another directory with Python. I'm trying to open some of those files within spss and it's giving me an error. When i open the copy manually & close it, run the same code it's opening. Is this an issue &/or fix? - Art
------------------------------
Art Jack
------------------------------