I am running though through a program that compares a spec to its CP module for a folder level program that tests about 10 specs total. After a week in development it works perfect on everything except the eighth spec / CP. It is as if the CP name is typed incorrectly but I copied and pasted all of them using the print FulName() function.
My code is similar to this: string nameSpec string nameCP namespec = "train engine spec" name CP = "train engine CP" mod = read(nameSpec) mod = current here I create an array of data m2 = read(NameCP) mod =current here I run through filters, counts, etc and output data
I get error messages because the CP part of the code is looking for CP attributes but the code runs as if "m2 = read(NameCP)" is never executed. I found by accident that if I type the name. If I comment o t the code that tests the 8th spec / CP combination, the other 9 work perfectly. I suspect there must be something different about the 8th CP that is causing it not to open, but I cant find anything different between the CPs. Any suggestions. This has been giving me trouble for two days. Thank you
Reality - Tue Feb 14 16:13:17 EST 2017 |
Re: unusual read error in DXl script You need to tell us the exact error message you getting and post the line of code, where the error occurs. Is it that the module cannot be opened? Regards, Mathias |
Re: unusual read error in DXl script The error message I get is " Atttribute "Change_Status" does not exist". After spending a lot of tike investigating I found the problem is that when the code gets to "m2 = read(NameCP) ", it does not open "NameCP". When I read the other 9 modules, they pop up on the screen when the code executes this read() command. However this particular CP Module never pops up. By accident I found that if I have spelling error in the NameCP strrig, I do not get a error when the read(NameCP) executes. The code continues to run and I eventually get the same "Attribute "Change_Status" does not exist" because the code is not working in the CP module. I am convinced the read() opens all nine other CPmodules but this one it will not open,. However I could not find a difference in modules that allows for the other 9 to open and this on does not open. THank you
|
Re: unusual read error in DXl script Reality - Wed Feb 15 13:56:00 EST 2017 The error message I get is " Atttribute "Change_Status" does not exist". After spending a lot of tike investigating I found the problem is that when the code gets to "m2 = read(NameCP) ", it does not open "NameCP". When I read the other 9 modules, they pop up on the screen when the code executes this read() command. However this particular CP Module never pops up. By accident I found that if I have spelling error in the NameCP strrig, I do not get a error when the read(NameCP) executes. The code continues to run and I eventually get the same "Attribute "Change_Status" does not exist" because the code is not working in the CP module. I am convinced the read() opens all nine other CPmodules but this one it will not open,. However I could not find a difference in modules that allows for the other 9 to open and this on does not open. THank you
I asked a colleague to look at my code because he has lot of experience in DXL. He agrees that problem is centered around the read() command not working on the 9th spec.. He could not offer any advise to why I would not open even though worked fine with you access it manually. He suspected that possible the CP spec might have been corrupted in a way that does not allow the read command to work but does work when you open manually |
Re: unusual read error in DXl script Reality - Wed Feb 15 14:02:09 EST 2017 I asked a colleague to look at my code because he has lot of experience in DXL. He agrees that problem is centered around the read() command not working on the 9th spec.. He could not offer any advise to why I would not open even though worked fine with you access it manually. He suspected that possible the CP spec might have been corrupted in a way that does not allow the read command to work but does work when you open manually You are probably facing a "current" Module problem. I think you can be reassured, that when you can open the module inside the DOORS client, that the "read" command will work fine too. There are some commands in DXL which use the "current" Module. An example would be the create attribute perm, if you do create text attribute "MyAttr" then the attribute will be created in the current module. However since the current module is global for all DXL scripts, a DXL attribute that executes can change the current module. So if you do read (moduleName) you will have in 9 out of 10 cases "current" afterwards to be the module you just opened, but in some cases its not (when some DXL script executed at module open changes the current module). So what can you do? Do not rely on the current module. Use commands that have an explicit module parameter, instead of exists attribute "Test" do AttrDef ad = find(mod, attrName); As I said, please post the complete error message with traceback (line number) and post the code line, where the error occurs. The error you are getting comes from the fact, that the attribute does not exist inside a module (and you probably try to write to it). It has nothing to do with a module not being opened. Regards, Mathias
|
Re: unusual read error in DXl script Mathias Mamsch - Wed Feb 15 17:28:36 EST 2017 You are probably facing a "current" Module problem. I think you can be reassured, that when you can open the module inside the DOORS client, that the "read" command will work fine too. There are some commands in DXL which use the "current" Module. An example would be the create attribute perm, if you do create text attribute "MyAttr" then the attribute will be created in the current module. However since the current module is global for all DXL scripts, a DXL attribute that executes can change the current module. So if you do read (moduleName) you will have in 9 out of 10 cases "current" afterwards to be the module you just opened, but in some cases its not (when some DXL script executed at module open changes the current module). So what can you do? Do not rely on the current module. Use commands that have an explicit module parameter, instead of exists attribute "Test" do AttrDef ad = find(mod, attrName); As I said, please post the complete error message with traceback (line number) and post the code line, where the error occurs. The error you are getting comes from the fact, that the attribute does not exist inside a module (and you probably try to write to it). It has nothing to do with a module not being opened. Regards, Mathias
Mathias Greatly appreciate your responses. The error message I get is a "DOORS report" popup window with message "Attribute CP ATTR- Change Type does not exist.". I click on the "OK" button and the script continues to run and then it outputs bad data. There is no error message with traceback line number. I cannot cut and paste the code so forgive any typos. Module m2 mod = read(NameReqSpec) mod = current f= (Attribute "Is_Reqmt" =="True") set (f) Here I have algorithm to count objects after filter mod = read(NameCP) mod - current f= (Attribute "CP_Status =="New") Here I have algorithm to count objects after filter
Note if modify one NameCP of the nine module pairs ( module pair is Spec and its associated CP) that works and change it to an incorrect filename, I get the xact same response from the one module pair that never woks
Thank you
|
Re: unusual read error in DXl script Reality - Thu Feb 16 13:48:24 EST 2017 Mathias Greatly appreciate your responses. The error message I get is a "DOORS report" popup window with message "Attribute CP ATTR- Change Type does not exist.". I click on the "OK" button and the script continues to run and then it outputs bad data. There is no error message with traceback line number. I cannot cut and paste the code so forgive any typos. Module m2 mod = read(NameReqSpec) mod = current f= (Attribute "Is_Reqmt" =="True") set (f) Here I have algorithm to count objects after filter mod = read(NameCP) mod - current f= (Attribute "CP_Status =="New") Here I have algorithm to count objects after filter
Note if modify one NameCP of the nine module pairs ( module pair is Spec and its associated CP) that works and change it to an incorrect filename, I get the xact same response from the one module pair that never woks
Thank you
If you say there is no traceback, this is not a DXL error you are getting... Maybe its a errorBox from inside your code? Without the code, I cannot tell. I do not see, why you would not be able to post the code. You can also attach it as a file. Or as a screenshot. Or whatever. Still - if the message says "CP ATTR- Change Type" does not exist, then I would check all my modules for this attribute. Regards, Mathias |
Re: unusual read error in DXl script Mathias Mamsch - Sat Feb 18 13:04:20 EST 2017 If you say there is no traceback, this is not a DXL error you are getting... Maybe its a errorBox from inside your code? Without the code, I cannot tell. I do not see, why you would not be able to post the code. You can also attach it as a file. Or as a screenshot. Or whatever. Still - if the message says "CP ATTR- Change Type" does not exist, then I would check all my modules for this attribute. Regards, Mathias My apologies. I probably gave you the wrong impression by titling this "read error". The only message is "DOORS report" popup window with message "Attribute CP ATTR- Change Type does not exist.." Technically this is not a DXL error. It continues to executes after I click "ok" in the DORS Report pop up window. I cannot post the code because it is on an isolated network that does not have internet. To transfer files from that network to this one is a huge beauracracy battle. It is 780 lines to type in the entire code. |
Re: unusual read error in DXl script Reality - Mon Feb 20 09:46:56 EST 2017 My apologies. I probably gave you the wrong impression by titling this "read error". The only message is "DOORS report" popup window with message "Attribute CP ATTR- Change Type does not exist.." Technically this is not a DXL error. It continues to executes after I click "ok" in the DORS Report pop up window. I cannot post the code because it is on an isolated network that does not have internet. To transfer files from that network to this one is a huge beauracracy battle. It is 780 lines to type in the entire code. Ok, then this is most likely a messagebox from the DXL itself. You should scan the code for the error message "does not exist" and look for the condition under that the message is raised. This will clear up, why for this one module that error is raised. Regards, Mathias |
Re: unusual read error in DXl script Mathias Mamsch - Tue Feb 21 02:27:32 EST 2017 Ok, then this is most likely a messagebox from the DXL itself. You should scan the code for the error message "does not exist" and look for the condition under that the message is raised. This will clear up, why for this one module that error is raised. Regards, Mathias I had to put this project and hold and just now got back to it. I wrote the script and this messagebox does not come from the script. I did one other thing. I show where I put in a "close" command below. Now the code runs on everything but this one CP Module now gives me a runtime error. I watsed another half day trying to figure this out to no avail
Module m2 mod = read(NameReqSpec) mod = current f= (Attribute "Is_Reqmt" =="True") set (f) close current Module Here I have algorithm to count objects after filter mod = read(NameCP) mod - current f= (Attribute "CP_Status =="New") // This is line 155 Here I have algorithm to count objects after filter
The runtime error message is "line 155 requires a current module." I am very confident that the "mod = read(NameCP)" command works for the other 10-modules but will not open this one. However I can open it fine manually.
|
Re: unusual read error in DXl script Reality - Tue Mar 07 11:06:29 EST 2017 I had to put this project and hold and just now got back to it. I wrote the script and this messagebox does not come from the script. I did one other thing. I show where I put in a "close" command below. Now the code runs on everything but this one CP Module now gives me a runtime error. I watsed another half day trying to figure this out to no avail
Module m2 mod = read(NameReqSpec) mod = current f= (Attribute "Is_Reqmt" =="True") set (f) close current Module Here I have algorithm to count objects after filter mod = read(NameCP) mod - current f= (Attribute "CP_Status =="New") // This is line 155 Here I have algorithm to count objects after filter
The runtime error message is "line 155 requires a current module." I am very confident that the "mod = read(NameCP)" command works for the other 10-modules but will not open this one. However I can open it fine manually.
You need to insert before line 155 a print ((null current Module) ? "NULL CURRENT" : (fullName current Module)) "\n" As I told you above, you will experience, that after opening the module the "current" Module is set to null, which happens when some DXL script kicks in after opening the module. If you would insert a current = mod before line 155 the error message would most certainly revert back to "Atttribute "Change_Status" does not exist" which only means, that you are trying to read the value of an attribute that does not exist in the way you expect it to (e.g. defined as Module attribute, but you try to read an object value, etc.). Regards, Mathias |
Re: unusual read error in DXl script Mathias Mamsch - Tue Mar 07 11:51:25 EST 2017 You need to insert before line 155 a print ((null current Module) ? "NULL CURRENT" : (fullName current Module)) "\n" As I told you above, you will experience, that after opening the module the "current" Module is set to null, which happens when some DXL script kicks in after opening the module. If you would insert a current = mod before line 155 the error message would most certainly revert back to "Atttribute "Change_Status" does not exist" which only means, that you are trying to read the value of an attribute that does not exist in the way you expect it to (e.g. defined as Module attribute, but you try to read an object value, etc.). Regards, Mathias I inserted this print statement before 155 . For the files that work it prints out the fullname. When it gets to the 8th spec it prints " NULL CREDIT " and then runtime error message is "line 155 requires a current module." |
Re: unusual read error in DXl script Reality - Mon Mar 13 18:11:51 EDT 2017 I inserted this print statement before 155 . For the files that work it prints out the fullname. When it gets to the 8th spec it prints " NULL CREDIT " and then runtime error message is "line 155 requires a current module." See! Exactly as I told you. After opening your module your "current" is set to null (which happens with DXL code inside the module being executed). Just remove any "mod = current" lines ... and open the module like this:
mod = read("...", ...);
current = mod // insert this and the current should be re-set correctly, so the "attribute" perm can work again
Regards, Mathias
|
Re: unusual read error in DXl script Mathias Mamsch - Tue Mar 14 05:25:34 EDT 2017 See! Exactly as I told you. After opening your module your "current" is set to null (which happens with DXL code inside the module being executed). Just remove any "mod = current" lines ... and open the module like this:
mod = read("...", ...);
current = mod // insert this and the current should be re-set correctly, so the "attribute" perm can work again
Regards, Mathias
I did just as your stated. Still get the same error. My plan is to strip the program down to the very basics. THen try to type in the program line for line because maybe there is something in my program you are not expecting tht is causing the trouble. I have 786 lines of code so I cant do it as is. THANK YOU so much for your help. |
Re: unusual read error in DXl script Reality - Wed Mar 15 09:44:51 EDT 2017 I did just as your stated. Still get the same error. My plan is to strip the program down to the very basics. THen try to type in the program line for line because maybe there is something in my program you are not expecting tht is causing the trouble. I have 786 lines of code so I cant do it as is. THANK YOU so much for your help. You should really read all my answers from this thread again, until you understand your problem. Once you understand it, it will be obvious to you how to fix it. I told you in my second answer, that you have a "current" module problem. You can read about it in many posts of the forum to understand what is going on. There is really not much more I can tell you. Regards, Mathias |