My python script can't see the attachments attached to an issue with jira-python - python-jira

I've made a python script that creates Jira issues and attach a file to them.
This part works fine and I can see the attachment directly in Jira. I can also see the attachment in my Python script if I reference directly the attachment ID (that I've found in the Jira page of my issue) with that bit of code :
att = jira.attachment(116328)
print att
But if I open the issue in my Python script, I won't see any attachment attached to it :
issue = jira.issue('ARR-10')
print issue.fields.attachment
Will return : AttributeError: type object 'PropertyHolder' has no attribute 'attachment'
I was using the version 1.0.10 and upgraded to 2.0.0, but it didn't make a difference.
I'm sure that the issue I'm looking up has an attachment, I just can't understand why there are no attachment attributes. I've checked the "Questions that may already have your answer" but none of them are helping.
Thanks !

The Jira REST API doesn't return fields that are hidden in the field configuration. Verify that the Attachments field is not hidden in the field configuration.
Source: Fetching an Issue Via API Does Not Return All fields

Related

How to solve "A nonexistent object was used in an `State` of a Dash callback." when testing dash-manufacture-spc-dashboard

I have tried to use dash-manufacture-spc-dashboard from github. Everything works OK except daq.NumericInput indicators. They are totally missing from the first tab and when tab is opened error message appears to error log. I have to use more newer versions of some libraries compared to git example. Anyone else tested with never versions with similar error messages?
Link to example: https://dash.gallery/dash-manufacture-spc-dashboard/
Link to github:https://github.com/plotly/dash-sample-apps/commits/main/apps/dash-manufacture-spc-dashboard3
Example of definition numericInput:
ud_usl_input = daq.NumericInput(
id="ud_usl_input", className="setting-input", size=200, max=9999999
)
Error message:
A nonexistent object was used in an State of a Dash callback. The id
of this object is ud_usl_input and the property is value. The
string ids in the current layout are: [big-app-container, banner,
banner-text, banner-logo, learn-more-button, logo, interval-component,
app-container, tabs, app-tabs, Specs-tab, Control-chart-tab,
app-content, value-setter-store, n-interval-stage, markdown,
markdown-container, markdown_close, set-specs-intro-container,
settings-menu, metric-select-menu, metric-select-title,
metric-select-dropdown, value-setter-menu, value-setter-panel,
button-div, value-setter-set-btn, value-setter-view-btn,
value-setter-view-output
]
By using exact versions all works now.
dash==2.6.2 --> 1.0.2
dash-daq== 0.5.0 --> 0.1.7
Hopefully this will be updated someday.

python-docx v0.8.10 - Unable to read/add header

Attempting to create a new document with headers and footers, but without success.
My code:
doc = Document()
section = doc.sections[0]
header = section.header
...
Unfortunately I am not able to figure out how to "initialize" the header section, as this code fails, throwing the following exception:
header = sections[0].header
AttributeError: 'Section' object has no attribute 'header'
I have also tried the approach creating a Word document with headers and footers beforehand and loading into python-docx, but unfortunately it ends with the same result.
Anyone able to point me in the right direction?
Sounds like a version problem. v0.8.8 would give you that error, for example, since headers were added in the last release. You can check the version that is actually executing with:
import docx
print(docx.__version__)
Could be an environment mixup or something like that. If you need to reinstall, try this:
pip install python-docx==0.8.10
just to make sure you're getting the version you expect and not perhaps a cached earlier version.

How to release PyIPropertyStore instance to allow os.rename

I am trying to get the media created datetime of a file using python, with reference to this question, Python - how to read Windows "Media Created" date (not file creation date), I have successfully gotten the media created datetime from the answer provided by https://stackoverflow.com/users/205580/eryksun
However, the action following that is os.rename(file_i_got_media_created_datetime_from, destination_path), which will not execute, no error is shown. I have figured out after hours that this may be because
properties = propsys.SHGetPropertyStoreFromParsingName(filepath) still holds a reference to the file, thus os.rename cannot proceed to rename without that reference from being released.
I would like to know how i can release this reference/pointer to the file so that it can be released for os.rename to do its job.
Btw i have googled extensively on pythoncom and havent got a clue as to how to do this, the documentation isn't rly clear and not much tutorials on the lib.
EDIT:
I used the del keyword to delete the variable properties which removed the reference and it worked.
just set properties = None and once the object is released, the file handle will be closed. I tried with my script and worked

SoapUI Groovy Script that sets test case property not reflected in LoadUI

I am using LoadUI 2.6.8 and SoapUI 5.0.
I have been able to do Property Transfers into Test Case properties that are successfully passed between SoapUI Runners in LoadUI as described here: http://www.loadui.org/soapui-integration/passing-along-testcase-properties.html
The problem I am having is that one of the properties I am setting via a Groovy Script like this:
def tc = testRunner.testCase.testSuite.getTestCaseByName("Auth and Start Up")
tc.setPropertyValue("Cookie","$jsesid")
is not being updated in LoadUI (when the groovy script runs) and thus not being passed around properly.
I have to use a groovy script because the cookie comes in as part of the response header and the normal Property Transfer Step doesn't allow me to do the transfer.
Has anyone encountered this before? Any insight into why this would be happening?
Thanks!
UPDATE: I managed to get around this issue by updating the Authentication API response to include the cookie as part of the response body (instead of just the header) and thus I was able to use the Property Transfer step which seems to work. This is still a workaround though.
Thanks for the link SiKing, I think I actually ran across that while trying to figure out the cookies, which I eventually managed to get working by setting the headers manually using the script. In order to test if it was a cookie issue I used another property. I added the following line to the groovy script:
tc.setPropertyValue("testprop","blah")
ran it in SoapUI and the property value is set ok. I then changed the value of the test case property "testprop" in the SoapUI test case to "a" manually and saved the project.
In LoadUI I ran the SoapUI Runner and the output for this property shows as "a" eventhough the groovy script ran fine. The more I play around with it the more I think its some kind of bug in LoadUI :(

SAP, how to checkIn document files?

I want to create a new document in SAP. Additional I have some files which belongs to this document, these files I want to upload to the SAP knwolegde base.
I'm using BAPI_DOCUMENT_CREATE2 to create or BAPI_DOCUMENT_CHECKIN2 to add files to a document info data. Every thing works fine, except file upload or checkin.
I'm using the DOCUMENTFILES table. I add a row for each file, currently I set only three fields:
row["STORAGECATEGORY"] = "DMS_C1_ST";
row["DOCFILE"] = "c:\temp\bom.pdf";
row["WASAPPLICATION"] = "PDF";
BAPI erro message:
"Error while checking in and storing c:/temp/bom.pdf"
I set the parameter
PF_FTP_DEST = "SAPFTPA";
PF_HTTP_DEST = "SAPHTTPA";
I have looked in the log data (slg1). I found following entry:
ERRMSG: Error in opening file "..." for reading (No such file or directrory)
V1: SCMS_DOC_CREATE_FILES
V2: 13
It would be nice if anybody has an idea and could bring some light in this issue.
Thanks in advance
Thomas
Remember that BAPIS run inside the application server and are not allowed to make any assumptions about the client side. This also means that they can't call back to the SAP GUI and upload a file from there. C:\temp\bom.pdf has to be a file on the application server, not your local machine!
Have you considered using
row["DOCFILE"] = "bom.pdf";
row["DOCPATH"] = "c:\temp\";
Let me know how it goes, or if you have already done with it then please paste your solution.

Resources