michael
December 20, 2021, 3:46am
1
I’m still trying to create and relocate a batch of .csv files. The creation side seems OK but I get this response:
when this statement is executed:
filerename CSVSourcePath + CSVFileName, InboundPath + CSVFileName
This is the environment:
The global variable paths have been defined and used without failure in prior parts of the procedure but here they are, just in case:
InboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/CSV files for import/"
CSVSourcePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/CSV source files/"
Clearly, both items mentioned in the error message do exist, so what’s happening?
dave
December 20, 2021, 3:53am
2
This path includes a folder named " Import testing" (with a space at the beginning.) It doesn’t look like that folder name actually begins with a space.
dave
December 20, 2021, 5:30am
3
I am moving the next four posts to this topic, because they are related to this one, rather than the one where you posted.
michael
December 20, 2021, 2:52am
4
I’ve posted as a follow-up to this thread rather than create a new one because I suspect they’re related.
The databaseexportcsv
statement works fine if I stay in my own paddock (ie, no path data preceding the file name) but if I put any sort of path into the parameter it fails with an error message like this:
Is this a bug or am I missing something?
dave
December 20, 2021, 3:39am
5
It’s working for me. Could you give us an example of a path that fails in this way?
michael
December 20, 2021, 3:54am
6
This is the relevant code. All variables have been declared.
; Assign values to the five folder path variables and ensure that the paths are terminated by a slash character
InboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/CSV files for import"
OutboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/Converted CSV files"
CSVSourcePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/CSV source files"
CoreFilePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/Core files"
ImportTestingPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Import testing"
InboundPath = InboundPath + ?(InboundPath endswith "/","","/")
OutboundPath = OutboundPath + ?(OutboundPath endswith "/","","/")
CSVSourcePath = CSVSourcePath + ?(CSVSourcePath endswith "/","","/")
CoreFilePath = CoreFilePath + ?(CoreFilePath endswith "/","","/")
ImportTestingPath = ImportTestingPath + ?(ImportTestingPath endswith "/","","/")
ImportFilesArray = "+TickerStats,+TickerProfiles,+AccountStats"
; Create the csv files and place them in the appropriate folder
looparray ImportFilesArray, ",", FileName
openfile CSVSourcePath + FileName
CSVFileName = "-" + lower(FileName[2,-1][1,1]) + FileName[3,-1]+ ".csv"
databaseexportcsv InboundPath + CSVFileName
closefile
endloop
dave
December 20, 2021, 3:58am
7
It looks like the same problem as the other topic. You have a space in the path that doesn’t belong there.
michael
December 20, 2021, 5:37am
8
Spot on Dave. I looked for an error in the path but didn’t see it because of the width setting on my procedure:
You can see that the space is the trailing character in the first line and therefore not at all apparent. But, if I was in doubt, it would have been better to re-create the folder paths.
Thank you.
admin
December 20, 2021, 6:45pm
9
Tip: To get a file or folder path into your code, drag the file or folder from the Finder straight into your procedure window. The exact path will be dropped into your code.
cmcp
December 20, 2021, 6:57pm
10
Nice tip! (But I have to type more, so: really nice tip!)
michael
December 20, 2021, 9:25pm
11
But be aware that the dragged path doesn’t include a trailing slash so, if you want to use it with a file name (which I guess is mostly), you need to add the slash character which is easy to forget. I always put something like this after a dragged path:
InboundPath = InboundPath + ?(InboundPath endswith "/","","/")