Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14521 > unrolled thread
| Started by | "McHale, Paul" <Paul.McHale@excelitas.com> |
|---|---|
| First post | 2013-05-18 06:38 +0000 |
| Last post | 2013-05-23 07:52 +0000 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Comment about SetDirectory[] "McHale, Paul" <Paul.McHale@excelitas.com> - 2013-05-18 06:38 +0000
Re: Comment about SetDirectory[] Alexey Popkov <lehin.p@gmail.com> - 2013-05-21 04:02 +0000
Re: Comment about SetDirectory[] "Alexey Popkov" <lehin.p@gmail.com> - 2013-05-21 04:02 +0000
Re: Comment about SetDirectory[] John Fultz <jfultz@wolfram.com> - 2013-05-22 06:18 +0000
Re: Comment about SetDirectory[] "Alexey Popkov" <lehin.p@gmail.com> - 2013-05-22 06:18 +0000
Re: Comment about SetDirectory[] Helen Read <readhpr@gmail.com> - 2013-05-23 07:54 +0000
Re: Comment about SetDirectory[] "Alexey Popkov" <lehin.p@gmail.com> - 2013-05-24 09:24 +0000
Re: Comment about SetDirectory[] W Craig Carter <ccarter@MIT.EDU> - 2013-05-23 07:52 +0000
| From | "McHale, Paul" <Paul.McHale@excelitas.com> |
|---|---|
| Date | 2013-05-18 06:38 +0000 |
| Subject | Comment about SetDirectory[] |
| Message-ID | <kn77kd$8ig$1@smc.vnet.net> |
I have often wondered whether to use: SetDirectory[NotebookDirectory[]] Export["TestResultTime.txt", mTimeDiff, "Table"] or Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] I have left Mathematica open for 2 days as it was running a very long test. Maybe something became corrupted. The first method did not work. It appears SetDirectory[] simply stopped functioning. Personally, I think the second method is better since it is atomic in nature. It doesn't depend on any stateful settings. Has anyone else had this issue? Thanks, Paul McHale | Electrical Engineer, Energetic Systems | Excelitas Technologies Corp. Office: +1 937.865.3004 | Fax: +1 937.865.5170 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 Paul.McHale@Excelitas.com www.excelitas.com
[toc] | [next] | [standalone]
| From | Alexey Popkov <lehin.p@gmail.com> |
|---|---|
| Date | 2013-05-21 04:02 +0000 |
| Message-ID | <knerl7$33$1@smc.vnet.net> |
| In reply to | #14521 |
Hi Paul, I would not recommend to use the Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] form if you are exporting many such files because NotebookDirectory[] sometimes (approximately one time in 500 exports in one of my programs) returns nothing and the file is exported to the default directory. As to your case I think it is possible that SetDirectory[] worked but NotebookDirectory[] failed... I would recommend to check the output of NotebookDirectory[] with StringLength. With best wishes, Alexey On Saturday, May 18, 2013 10:38:05 AM UTC+4, McHale, Paul wrote: > I have often wondered whether to use: > > > > SetDirectory[NotebookDirectory[]] > > Export["TestResultTime.txt", mTimeDiff, "Table"] > > > > or > > > > Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] > > > > I have left Mathematica open for 2 days as it was running a very long test. Maybe something became corrupted. The first method did not work. It appears SetDirectory[] simply stopped functioning. Personally, I think the second method is better since it is atomic in nature. It doesn't depend on any stateful settings. > > > > Has anyone else had this issue? > > > > Thanks, > > > > Paul McHale | Electrical Engineer, Energetic Systems | Excelitas Technologies Corp. > > > > Office: +1 937.865.3004 | Fax: +1 937.865.5170 > > 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 > > Paul.McHale@Excelitas.com > > www.excelitas.com
[toc] | [prev] | [next] | [standalone]
| From | "Alexey Popkov" <lehin.p@gmail.com> |
|---|---|
| Date | 2013-05-21 04:02 +0000 |
| Message-ID | <knerka$2l$1@smc.vnet.net> |
| In reply to | #14521 |
Hi Paul, I would not recommend to use the Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] form if you are exporting many such files because NotebookDirectory[] sometimes (approximately one time in 500 exports in one of my programs) returns nothing and the file is exported to the default directory. As to your case I think it is possible that SetDirectory[] worked but NotebookDirectory[] failed... I would recommend to check the output of NotebookDirectory[] with StringLength. with best wishes, Alexey "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... I have often wondered whether to use: SetDirectory[NotebookDirectory[]] Export["TestResultTime.txt", mTimeDiff, "Table"] or Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] I have left Mathematica open for 2 days as it was running a very long test. Maybe something became corrupted. The first method did not work. It appears SetDirectory[] simply stopped functioning. Personally, I think the second method is better since it is atomic in nature. It doesn't depend on any stateful settings. Has anyone else had this issue? Thanks, Paul McHale | Electrical Engineer, Energetic Systems | Excelitas Technologies Corp. Office: +1 937.865.3004 | Fax: +1 937.865.5170 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 Paul.McHale@Excelitas.com www.excelitas.com
[toc] | [prev] | [next] | [standalone]
| From | John Fultz <jfultz@wolfram.com> |
|---|---|
| Date | 2013-05-22 06:18 +0000 |
| Message-ID | <knhnvj$9km$1@smc.vnet.net> |
| In reply to | #14521 |
I've never heard of or seen Alexey's issue before. However, it is the case that NotebookDirectory[] will return $Failed if you execute NotebookDirectory[]: * in a notebook which hasn't been saved to disk, and therefore doesn't have a notebook. * in an evaluation which wasn't directly triggered by a specific notebook, such as a ScheduledTask. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. On May 20, 2013, at 11:02 PM, "Alexey Popkov" <lehin.p@gmail.com> wrote: > Hi Paul, > > I would not recommend to use the > > Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] > > form if you are exporting many such files because NotebookDirectory[] > sometimes (approximately one time in 500 exports in one of my programs) > returns nothing and the file is exported to the default directory. > > As to your case I think it is possible that SetDirectory[] worked but > NotebookDirectory[] failed... I would recommend to check the output of > NotebookDirectory[] with StringLength. > > with best wishes, > Alexey > > > > "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... > > I have often wondered whether to use: > > SetDirectory[NotebookDirectory[]] > Export["TestResultTime.txt", mTimeDiff, "Table"] > > or > > Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] > > I have left Mathematica open for 2 days as it was running a very long test. > Maybe something became corrupted. The first method did not work. It > appears SetDirectory[] simply stopped functioning. Personally, I think the > second method is better since it is atomic in nature. It doesn't depend on > any stateful settings. > > Has anyone else had this issue? > > Thanks, > > Paul McHale | Electrical Engineer, Energetic Systems | Excelitas > Technologies Corp. > > Office: +1 937.865.3004 | Fax: +1 937.865.5170 > 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 > Paul.McHale@Excelitas.com > www.excelitas.com > >
[toc] | [prev] | [next] | [standalone]
| From | "Alexey Popkov" <lehin.p@gmail.com> |
|---|---|
| Date | 2013-05-22 06:18 +0000 |
| Message-ID | <knhnvo$9kt$1@smc.vnet.net> |
| In reply to | #14521 |
John, The case I had mentioned is related to creating an animation based on Dynamic interface. I know that it is not straightforward way but it was simplest since I originally made a Dynamic presentation and the easier way was just Export a Table of frames each has different value of a time-related parameter (which was Dynamic). I had about 2500 such GIF frames in my exported animation and I recreated them several times while I polished my animation. And I did not change my Export code: file path was always started with "NotebookDiretory[]<>...". And finally I found about 5 of about each 2500 exported frames in the documents directory on disk C:\ (I always place my documents on disk D:\ and here was placed the evaluating notebook). All other frames was exported to requested location on disk D:\. The missing (unexpectedly exported to the documents directory on disk C:\) frames result in significant damage of my animation. Sincerely, Alexey -----Original message----- From: John Fultz Sent: Tuesday, May 21, 2013 8:51 PM To: Alexey Popkov Cc: mathgroup@smc.vnet.net Subject: Re: Comment about SetDirectory[] I've never heard of or seen Alexey's issue before. However, it is the case that NotebookDirectory[] will return $Failed if you execute NotebookDirectory[]: * in a notebook which hasn't been saved to disk, and therefore doesn't have a notebook. * in an evaluation which wasn't directly triggered by a specific notebook, such as a ScheduledTask. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. On May 20, 2013, at 11:02 PM, "Alexey Popkov" <lehin.p@gmail.com> wrote: > Hi Paul, > > I would not recommend to use the > > Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] > > form if you are exporting many such files because NotebookDirectory[] > sometimes (approximately one time in 500 exports in one of my programs) > returns nothing and the file is exported to the default directory. > > As to your case I think it is possible that SetDirectory[] worked but > NotebookDirectory[] failed... I would recommend to check the output of > NotebookDirectory[] with StringLength. > > with best wishes, > Alexey > > > > "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... > > I have often wondered whether to use: > > SetDirectory[NotebookDirectory[]] > Export["TestResultTime.txt", mTimeDiff, "Table"] > > or > > Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] > > I have left Mathematica open for 2 days as it was running a very long > test. > Maybe something became corrupted. The first method did not work. It > appears SetDirectory[] simply stopped functioning. Personally, I think > the > second method is better since it is atomic in nature. It doesn't depend > on > any stateful settings. > > Has anyone else had this issue? > > Thanks, > > Paul McHale | Electrical Engineer, Energetic Systems | Excelitas > Technologies Corp. > > Office: +1 937.865.3004 | Fax: +1 937.865.5170 > 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 > Paul.McHale@Excelitas.com > www.excelitas.com > >
[toc] | [prev] | [next] | [standalone]
| From | Helen Read <readhpr@gmail.com> |
|---|---|
| Date | 2013-05-23 07:54 +0000 |
| Message-ID | <knkhv9$idq$1@smc.vnet.net> |
| In reply to | #14572 |
Did you not try SetDirectory[NotebookDirectory[]] to set it once and be done with it? On 5/22/2013 2:18 AM, Alexey Popkov wrote: > John, > > The case I had mentioned is related to creating an animation based on > Dynamic interface. I know that it is not straightforward way but it was > simplest since I originally made a Dynamic presentation and the easier way > was just Export a Table of frames each has different value of a time-related > parameter (which was Dynamic). I had about 2500 such GIF frames in my > exported animation and I recreated them several times while I polished my > animation. And I did not change my Export code: file path was always started > with "NotebookDiretory[]<>...". And finally I found about 5 of about each > 2500 exported frames in the documents directory on disk C:\ (I always place > my documents on disk D:\ and here was placed the evaluating notebook). All > other frames was exported to requested location on disk D:\. The missing > (unexpectedly exported to the documents directory on disk C:\) frames result > in significant damage of my animation. > > Sincerely, > Alexey > > > -----Original message----- > From: John Fultz > Sent: Tuesday, May 21, 2013 8:51 PM > To: Alexey Popkov > Cc: mathgroup@smc.vnet.net > Subject: Re: Comment about SetDirectory[] > > I've never heard of or seen Alexey's issue before. However, it is the case > that NotebookDirectory[] will return $Failed if you execute > NotebookDirectory[]: > > * in a notebook which hasn't been saved to disk, and therefore doesn't have > a notebook. > * in an evaluation which wasn't directly triggered by a specific notebook, > such as a ScheduledTask. > > John Fultz > jfultz@wolfram.com > User Interface Group > Wolfram Research, Inc. > > > > On May 20, 2013, at 11:02 PM, "Alexey Popkov" <lehin.p@gmail.com> wrote: > >> Hi Paul, >> >> I would not recommend to use the >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> form if you are exporting many such files because NotebookDirectory[] >> sometimes (approximately one time in 500 exports in one of my programs) >> returns nothing and the file is exported to the default directory. >> >> As to your case I think it is possible that SetDirectory[] worked but >> NotebookDirectory[] failed... I would recommend to check the output of >> NotebookDirectory[] with StringLength. >> >> with best wishes, >> Alexey >> >> >> >> "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... >> >> I have often wondered whether to use: >> >> SetDirectory[NotebookDirectory[]] >> Export["TestResultTime.txt", mTimeDiff, "Table"] >> >> or >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> I have left Mathematica open for 2 days as it was running a very long >> test. >> Maybe something became corrupted. The first method did not work. It >> appears SetDirectory[] simply stopped functioning. Personally, I think >> the >> second method is better since it is atomic in nature. It doesn't depend >> on >> any stateful settings. >> >> Has anyone else had this issue? >> >> Thanks, >> >> Paul McHale | Electrical Engineer, Energetic Systems | Excelitas >> Technologies Corp. >> >> Office: +1 937.865.3004 | Fax: +1 937.865.5170 >> 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 >> Paul.McHale@Excelitas.com >> www.excelitas.com >> >> > >
[toc] | [prev] | [next] | [standalone]
| From | "Alexey Popkov" <lehin.p@gmail.com> |
|---|---|
| Date | 2013-05-24 09:24 +0000 |
| Message-ID | <knnbk4$qpn$1@smc.vnet.net> |
| In reply to | #14592 |
Yes, SetDirectory[NotebookDirectory[]] works nice for me. After changing the Export code (removing NotebookDiretory[]<>) and setting directory with SetDirectory[NotebookDirectory[]] I have no more problems with files placed at wrong location. "Helen Read" wrote:knkhv9$idq$1@smc.vnet.net... Did you not try SetDirectory[NotebookDirectory[]] to set it once and be done with it? On 5/22/2013 2:18 AM, Alexey Popkov wrote: > John, > > The case I had mentioned is related to creating an animation based on > Dynamic interface. I know that it is not straightforward way but it was > simplest since I originally made a Dynamic presentation and the easier way > was just Export a Table of frames each has different value of a > time-related > parameter (which was Dynamic). I had about 2500 such GIF frames in my > exported animation and I recreated them several times while I polished my > animation. And I did not change my Export code: file path was always > started > with "NotebookDiretory[]<>...". And finally I found about 5 of about each > 2500 exported frames in the documents directory on disk C:\ (I always > place > my documents on disk D:\ and here was placed the evaluating notebook). All > other frames was exported to requested location on disk D:\. The missing > (unexpectedly exported to the documents directory on disk C:\) frames > result > in significant damage of my animation. > > Sincerely, > Alexey > > > -----Original message----- > From: John Fultz > Sent: Tuesday, May 21, 2013 8:51 PM > To: Alexey Popkov > Cc: mathgroup@smc.vnet.net > Subject: Re: Comment about SetDirectory[] > > I've never heard of or seen Alexey's issue before. However, it is the > case > that NotebookDirectory[] will return $Failed if you execute > NotebookDirectory[]: > > * in a notebook which hasn't been saved to disk, and therefore doesn't > have > a notebook. > * in an evaluation which wasn't directly triggered by a specific notebook, > such as a ScheduledTask. > > John Fultz > jfultz@wolfram.com > User Interface Group > Wolfram Research, Inc. > > > > On May 20, 2013, at 11:02 PM, "Alexey Popkov" <lehin.p@gmail.com> wrote: > >> Hi Paul, >> >> I would not recommend to use the >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> form if you are exporting many such files because NotebookDirectory[] >> sometimes (approximately one time in 500 exports in one of my programs) >> returns nothing and the file is exported to the default directory. >> >> As to your case I think it is possible that SetDirectory[] worked but >> NotebookDirectory[] failed... I would recommend to check the output of >> NotebookDirectory[] with StringLength. >> >> with best wishes, >> Alexey >> >> >> >> "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... >> >> I have often wondered whether to use: >> >> SetDirectory[NotebookDirectory[]] >> Export["TestResultTime.txt", mTimeDiff, "Table"] >> >> or >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> I have left Mathematica open for 2 days as it was running a very long >> test. >> Maybe something became corrupted. The first method did not work. It >> appears SetDirectory[] simply stopped functioning. Personally, I think >> the >> second method is better since it is atomic in nature. It doesn't depend >> on >> any stateful settings. >> >> Has anyone else had this issue? >> >> Thanks, >> >> Paul McHale | Electrical Engineer, Energetic Systems | Excelitas >> Technologies Corp. >> >> Office: +1 937.865.3004 | Fax: +1 937.865.5170 >> 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 >> Paul.McHale@Excelitas.com >> www.excelitas.com >> >> > >
[toc] | [prev] | [next] | [standalone]
| From | W Craig Carter <ccarter@MIT.EDU> |
|---|---|
| Date | 2013-05-23 07:52 +0000 |
| Message-ID | <knkhs3$id9$1@smc.vnet.net> |
| In reply to | #14521 |
I've seen one other case. It was when the directory containing NotebookDirectory[] was deleted (by someone else on a shared disk). For example, temp.nb is written to ~/tmp/foo. ~/temp/foo is deleted with the notebook still open (a warning is dialog comes up.) But: NotebookDirectory[] yields: "/Users/ccarter/tmp/foo/" Export[NotebookDirectory[] <> "file.m", "test"] throws: Export::nodir: "Directory \!\(\"/Users/ccarter/tmp/foo/\"\) does not exist" Export::noopen: "Cannot open \!\(\"/Users/ccarter/tmp/foo/file.m\"\)." and returns: $Failed This is a perverse example, but still possible. If something similar happened (disk dismounted, remounted) in the middle of Paul's writing a sequence of files, he would get a failure. W Craig Carter Professor of Materials Science, MIT On May 22, 13, at 2:19 AM, John Fultz wrote: > I've never heard of or seen Alexey's issue before. However, it is the > case that NotebookDirectory[] will return $Failed if you execute > NotebookDirectory[]: > > * in a notebook which hasn't been saved to disk, and therefore doesn't > have a notebook. > * in an evaluation which wasn't directly triggered by a specific > notebook, such as a ScheduledTask. > > John Fultz > jfultz@wolfram.com > User Interface Group > Wolfram Research, Inc. > > > > On May 20, 2013, at 11:02 PM, "Alexey Popkov" <lehin.p@gmail.com> wrote: > >> Hi Paul, >> >> I would not recommend to use the >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> form if you are exporting many such files because NotebookDirectory[] >> sometimes (approximately one time in 500 exports in one of my programs) >> returns nothing and the file is exported to the default directory. >> >> As to your case I think it is possible that SetDirectory[] worked but >> NotebookDirectory[] failed... I would recommend to check the output of >> NotebookDirectory[] with StringLength. >> >> with best wishes, >> Alexey >> >> >> >> "McHale, Paul" wrote:kn77kd$8ig$1@smc.vnet.net... >> >> I have often wondered whether to use: >> >> SetDirectory[NotebookDirectory[]] >> Export["TestResultTime.txt", mTimeDiff, "Table"] >> >> or >> >> Export[NotebookDirectory[] <> "TestResultTime.txt", mTimeDiff, "Table"] >> >> I have left Mathematica open for 2 days as it was running a very long test. >> Maybe something became corrupted. The first method did not work. It >> appears SetDirectory[] simply stopped functioning. Personally, I think the >> second method is better since it is atomic in nature. It doesn't depend on >> any stateful settings. >> >> Has anyone else had this issue? >> >> Thanks, >> >> Paul McHale | Electrical Engineer, Energetic Systems | Excelitas >> Technologies Corp. >> >> Office: +1 937.865.3004 | Fax: +1 937.865.5170 >> 1100 Vanguard Boulevard, Miamisburg, OH 45342-0312 >> Paul.McHale@Excelitas.com >> www.excelitas.com >> >> > >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web