|
View:
New views
19 Messages
—
Rating Filter:
Alert me
|
|
|
Sending email attachments, zipping files, Invalid Pathname...I've inherited a DB (Mac, V11.4) that uses the following code to
prepare an attachment.... the routine fails with a -43 (as I recall) reporting that the source pathname was an issue when calling the "LAUNCH EXTERNAL PROCESS" call. 1) This was apparently working on Mac OS X Server (Leopard) on an Xserve... my development OS is Snow Leopard (10.6.1)... is there a difference in the way that pathnames are handled with different flavors of OS X? 2) I would not have thought to code this attachment this way... does this approach seem unusual? 3) I noticed that when I drag a file into Terminal it uses a pathname starting with Volumes... $FilePath starts with "HardDriveName:Users..." with no forward slash... $SourceFile starts with "/Users/UserFolderName..." Any clues here? 4) Should the pathname be in quotes? ========================= If (Test path name($FilePath)=1) C_TEXT($cmd;$in;$out;$err;$SourceFile;$ZipFile) $SourceFile:=Replace string($FilePath;":";"/") $SourceFile:=Substring($SourceFile;Position("/";$SourceFile);Length ($SourceFile)-(Position("/";$SourceFile)-1)) $ZipFile:=$SourceFile $ZipFile:=Substring($ZipFile;1;Length($ZipFile)-3)+"zip" $cmd:="ditto -c -k -X --norsrc "+Char(Double quote )+$SourceFile+Char (Double quote )+" "+Char(Double quote )+$ZipFile+Char(Double quote ) LAUNCH EXTERNAL PROCESS($cmd;$in;$out;$err) $Error:=$Error+SMTP_Attachment ($SMTP_ID;Substring($FilePath;1;Length ($FilePath)-3)+"zip";2;0) End if ========================= Thanks, Robert ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...On Nov 3, 2009, at 7:23 PM, Robert Broussard wrote: > 3) I noticed that when I drag a file into Terminal it uses a > pathname starting with Volumes... $FilePath starts with > "HardDriveName:Users..." with no forward slash... $SourceFile > starts with "/Users/UserFolderName..." ' $filePath is being used by Mac 4D calls so it would use the old Mac style semicolon separator The BSD terminal calls will use the Unix style forward / The leading slash tells BSD to start at the uppermost level -- the root. The Volumes allows you to use other attached drives. > Any clues here? To be honest LED calls can sometimes drive one crazy. Sometimes using the full BSD root path works. Other times the Bash shell .profile path allows some calls to be cut short starting from the "Users" home path if that is where they are located to start with. You can find the .profile doc in the user's home directory. But first you will need to tell the Mac to show all it's hidden .files The Mac hints website is great for all this under the hood stuff http://www.macosxhints.com/ Also for other under the hood Unix FAQ check this page out http://hayne.net/MacDev/Notes/unixFAQ.html > 4) Should the pathname be in quotes? Typically a terminal based filepath is put into double quotes when any of the words have a space between them. -Kevin ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...On Wed, Nov 4, 2009 at 4:23 AM, Robert Broussard <robert@...> wrote:
> 3) I noticed that when I drag a file into Terminal it uses a pathname > starting with Volumes... $FilePath starts with "HardDriveName:Users..." > with no forward slash... $SourceFile starts with > "/Users/UserFolderName..." Any clues here? If it is root volume, it does not matter if the path is /Volumes/HardDrive/Users/.... or /Users/.... but if it is not a root volume, it must be addressed with /Volumes/HardDrive/..... > 4) Should the pathname be in quotes? YEs, otherwise you should escape spaces with '\ '. In general, simple HFS-to-POSIX change of paths like $SourceFile:=Replace string($FilePath;":";"/") work only in simple cases. HFS path must not contain a '/' character, POSIX path should be in UTF-8 encoding etc. The simples case how you can find what is wrong is make breakpoint at LEP, copy the content of $cmd string in debugger window and paste it in Terminal. You should get error -43 too, but in terminal it is easier to find which parameter or flag is wrong. > $Error:=$Error+SMTP_Attachment > ($SMTP_ID;Substring($FilePath;1;Length($FilePath)-3)+"zip";2;0) Just a note - this code assumes the FilePath has an extension of 3 characters. -- Peter Bozek ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...On Nov 4, 2009, at 2:04 AM, Peter Bozek wrote:
> POSIX path should be in UTF-8 encoding etc. Okay, not sure what this means with respect to path names... Okay, I noticed that my $CMD variable that was feeding the External Process was being truncated... Unicode or Not it's still truncated??? How could this be??? Anyway, I'm now breaking things down so that no variable has to store more than 254. Now, when I'm calling this line of code: $Error:=$Error+SMTP_Attachment ($SMTP_ID;Substring($FilePath;1;Length ($FilePath)-3)+"zip";2;0) OR $Error:=$Error+SMTP_Attachment ($SMTP_ID;Replace string ($FilePath;".xls";".zip");0;1) I get a -37 Error which decoded via IT_ErrorText returns "Operation already in progress" while others say it means "Bad filename or volume name." Either way, I'm not sure how to resolve this.... The pathname being used by "SMTP_Attachment" is: Lagniappe:Users:robert:Desktop:NSS:Working:Attachments:harvwg8o 77030557:Order Transmit log 110409 711 PM.zip Any thoughts? The only thing I thought about was losing the spaces but this was working on a Leopard-based XServe but not on my Snow- based Mac Pro... Thanks, R ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Gosh, I'm still hurting here... I feel like I tried EVERYTHING.
I took out all of the spaces... still get the -37 error. I tried adding "Volumes:" to the pathname (that's suppose to work without the prefix) which resulted in my being presented with a selection dialog box and when I selected the file I still got the error... Then my Error routine kicked in showing an error 13... after a call to IT_SetPort or maybe SMTP_Send these routines (within the error handler) reports a 10064 error... What now??? R On Nov 4, 2009, at 7:28 PM, Robert Broussard wrote: > I get a -37 Error ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...According to the docs and some previous behavior this line of code
should prompt the user to select a file and this is NOT happening... I restarted 4D (11.5 MC2) and still no dialog. $Error:=$Error+SMTP_Attachment ($SMTP_ID;"";0;1) `retyped Thoughts? R On Nov 3, 2009, at 10:12 PM, Kevin LaTona wrote: > $filePath is being used by Mac 4D calls so it would use the old Mac > style semicolon separator ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Is there a way to know the file path that's being used when the user
selects the file manually? $Error1:=SMTP_Attachment ($SMTP_ID;"";2;0) `retyped The Document variable is not updated for this command and when I send the actual path in MANY forms it fails with a -37 error. R On Nov 3, 2009, at 10:12 PM, Kevin LaTona wrote: > $filePath is being used by Mac 4D calls so it would use the old Mac > style semicolon separator ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Command Select document On Nov 4, 2009, at 7:28 PM, Robert Broussard wrote: > Is there a way to know the file path that's being used when the user > selects the file manually? > > $Error1:=SMTP_Attachment ($SMTP_ID;"";2;0) `retyped > > The Document variable is not updated for this command and when I > send the actual path in MANY forms it fails with a -37 error. > > R > > On Nov 3, 2009, at 10:12 PM, Kevin LaTona wrote: > >> $filePath is being used by Mac 4D calls so it would use the old Mac >> style semicolon separator ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Hi,
C_TEXT($d) $e:=SMTP_New ($SMTP_ID) $e:=SMTP_Attachment ($SMTP_ID;$d;2;0) and $d will contain the selected document path. having said that, there is nothing wrong with passing an actual system path, long or short. it works. you mentioned you were passing Lagniappe:Users:robert:Desktop:NSS:Working:Attachments:harvwg8o 77030557:Order Transmit log 110409 711 PM.zip but what do you get if you test that path Test path name ? and just in case, you might want to test the behavior with a shorter path (>64) as you path is 109 code points long....(not that it is too long, just suggesting you narrow down the possible causes.) miyako On 2009/11/05, at 12:28, Robert Broussard wrote: > Is there a way to know the file path that's being used when the user > selects the file manually? > > $Error1:=SMTP_Attachment ($SMTP_ID;"";2;0) `retyped > > The Document variable is not updated for this command and when I > send the actual path in MANY forms it fails with a -37 error. > > R > > On Nov 3, 2009, at 10:12 PM, Kevin LaTona wrote: > >> $filePath is being used by Mac 4D calls so it would use the old Mac >> style semicolon separator ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Hi, miyako, Peter & Kevin... thanks for chiming in...
I can't believe that this is not working... I tried running in Leopard, moving the working folder to another directory to shorten pathnames... and many other things... When I test the existence of this file with "Test path name" it passes.... then I send that same pathname parameter to SMTP_Attachment and it fails with a -37 error. ===================== TEST Snippet LAUNCH EXTERNAL PROCESS("ditto -c -k -X --norsrc "+Char(Double quote )+$SourceFile+Char(Double quote )+" "+Char(Double quote )+ $ZipFile+Char(Double quote );$in;$out;$err) $ZipFile:=Replace string($FilePath;".xls";".zip") If (Test path name($ZipFile)=1) `passed! BEEP End if $Error:=$Error+SMTP_Attachment ($SMTP_ID;$ZipFile;2;0) `fails with a -37 error! ===================== BTW: the pathname for $ZipFile is: Lagniappe:NSS:Attachments:jwh3cjal_79880 :OrderTransmitLog_110409_1044_PM.zip `notice I have removed the spaces and shortened the path... still no change in behavior. Thoughts??? Thanks, Robert On Nov 4, 2009, at 10:29 PM, miyako wrote: > Lagniappe:Users:robert:Desktop:NSS:Working:Attachments:harvwg8o > 77030557:Order Transmit log 110409 711 PM.zip > but what do you get if you test that path > Test path name ? ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Okay I think I have a clue... If I call:
C_TEXT($d) $d:="" $e:=SMTP_New ($SMTP_ID) $e:=SMTP_Attachment ($SMTP_ID;$d;2;0) `I select the file via the dialog... the var $d is updated with the selected pathname..... Now, $d contains: Lagniappe:NSS:Attachments:jwh3cjal_79880:OrderTransmitLog_110#16351F.zip While the actual pathname selected is: Lagniappe:NSS:Attachments:jwh3cjal_79880 :OrderTransmitLog_110409_1044_PM.zip So, can you tell what's going on with these path names???? Thanks, Robert On Nov 4, 2009, at 10:29 PM, miyako wrote: > C_TEXT($d) > $e:=SMTP_New ($SMTP_ID) > $e:=SMTP_Attachment ($SMTP_ID;$d;2;0) > > and $d will contain the selected document path. ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Sorry,
I should have mentioned, Testing the path name is not enough. the ditto may still be in progress. try, get document size or open document+ON ERR CALL or something in a loop (with DELAY PROCESS) after you pass the path test. (there should be a more robust method, but just to make the point...) miyako On 2009/11/05, at 13:56, Robert Broussard wrote: > If (Test path name($ZipFile)=1) `passed! > BEEP > End if ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Yes, but in this case... I'm stepping through he debugger very slowly
and can verify in the finder, etc... the ditto operation is complete... there is something else going on here... take a look at my other email with the disparate pathnames... hopefully that will lead us to a solution. Thanks, Robert On Nov 4, 2009, at 11:07 PM, miyako wrote: > Testing the path name is not enough. > > the ditto may still be in progress. ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Sorry again,
you are using LEP in sync mode so ditto is complete. however, I think the Replace string line is unnecessary. > ===================== TEST Snippet > LAUNCH EXTERNAL PROCESS("ditto -c -k -X --norsrc "+Char(Double > quote )+$SourceFile+Char(Double quote )+" "+Char(Double quote )+ > $ZipFile+Char(Double quote );$in;$out;$err) > $ZipFile:=Replace string($FilePath;".xls";".zip") should be something like > $ZipFile:=$SourceFile+".zip" > LAUNCH EXTERNAL PROCESS("ditto -c -k -X --norsrc "+Char(Double > quote )+$SourceFile+Char(Double quote )+" "+Char(Double quote )+ > $ZipFile+Char(Double quote );$in;$out;$err) alternatively you could call SET ENVIRONMENT VARIABLE with the option _4D_OPTION_CURRENT_DIRECTORY to perform something similar to the cd command, but that is once you get the command in shape. regards, miyako ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...But then you would end up with something like:
Lagniappe:NSS:Attachments:foxf0lft_194754 :OrderTransmitLog_110409_1116_PM.xls.zip The line of code that you wanted to change simply replaces the .xls reference to the .zip... But, now we need to find out why 4D or SMTP_attachment does not like the pathname being supplied.... When I select the appropriate file via the open/save dialog triggered by sending an empty string as the path/file name to SMTP_Attachment, notice how it has an unusual pathname that is very different than the actual pathname... I think this is the key. Lagniappe:NSS:Attachments:jwh3cjal_79880 :OrderTransmitLog_110#16351F.zip `after selecting the file manually.... While the actual pathname of the selected file is: Lagniappe:NSS:Attachments:jwh3cjal_79880 :OrderTransmitLog_110409_1044_PM.zip So, can you tell what's going on with these path names???? GREAT! Robert On Nov 4, 2009, at 11:15 PM, miyako wrote: > should be something like > >> $ZipFile:=$SourceFile+".zip" >> LAUNCH EXTERNAL PROCESS("ditto -c -k -X --norsrc "+Char(Double >> quote )+$SourceFile+Char(Double quote )+" "+Char(Double quote )+ >> $ZipFile+Char(Double quote );$in;$out;$err) > ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...Hi,
I think the path is too long. there is a reported issue with IT_Encode and IT_Decode, where the maximum acceptable length to the command is 64, including the auto-added extension ".zip" or whatever, so 60 is the limit. "Lagniappe:NSS:Attachments:jwh3cjal_79880:OrderTransmitLog_11" is precisely 60 code points long. miyako On 2009/11/05, at 14:06, Robert Broussard wrote: > So, can you tell what's going on with these path names???? ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...yes you will,
if you don't like double extensions then you can change that to single. but that is not the point. >> LAUNCH EXTERNAL PROCESS("ditto -c -k -X --norsrc "+Char(Double >> quote )+$SourceFile+Char(Double quote )+" "+Char(Double quote )+ >> $ZipFile+Char(Double quote );$in;$out;$err) >> $ZipFile is the destination path so is should be defined before calling LEP not after. miyako On 2009/11/05, at 14:28, Robert Broussard wrote: > But then you would end up with something like: > > Lagniappe:NSS:Attachments:foxf0lft_194754 > :OrderTransmitLog_110409_1116_PM.xls.zip ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...I think you're right about the path being too long--I got it down to
55 characters and now the attachment part is working... My current pathname is: Lagniappe:NSS:Attachments:139104:OT_Log_091105_0231.zip Now I'm getting a 10064 Error when executing: $Error:=$Error+SMTP_Send ($SMTP_ID) Thoughts about this? It seems that this error is "No response has been received within the given timeout period" according to IT_ErrorText. Hopefully this will be easier to deal with than the pathname issue. BTW: it seems that a 60 character limit is VERY strict and I think undocumented... Would it not be very useful and somewhat trivial to expand this limitation??? Thanks, Robert On Nov 4, 2009, at 11:41 PM, miyako wrote: > Hi, > > I think the path is too long. > there is a reported issue with IT_Encode and IT_Decode, > where the maximum acceptable length to the command is 64, > including the auto-added extension ".zip" or whatever, so 60 is the > limit. > > "Lagniappe:NSS:Attachments:jwh3cjal_79880:OrderTransmitLog_11" > > is precisely 60 code points long. > > miyako ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
|
|
Re: Sending email attachments, zipping files, Invalid Pathname...On Thu, Nov 5, 2009 at 6:06 AM, Robert Broussard <robert@...> wrote:
> Now, $d contains: > > Lagniappe:NSS:Attachments:jwh3cjal_79880:OrderTransmitLog_110#16351F.zip Well, it seems that IC works with some very old HFS calls, and very long time ago there was 31 char limit on HFS file names (and 27 chars on folder names or so.) While paths can be up to 255 char long, try to limit file names to 31 characters. -- Peter Bozek ********************************************************************** Get the speed and power of 4D v11 SQL before upgrade prices increase - http://www.4d.com 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4D.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4D_Tech-Unsubscribe@... ********************************************************************** |
| Free embeddable forum powered by Nabble | Forum Help |