Finding all unknown attachments

Robert E_ Schneider August 23, 2018

After importing a Word document which contains pictures I find the Wiki-page to contain a hint "? Unbekannter Anhang" (unknown attachment).

Apparently something went wrong during the import.

Since I have imported several documents there might be other locations with this issue.

Is there a way to search for all occurences of this "? Unbekannter Anhang" hints, so that I can find and correct them easily?

3 answers

1 accepted

1 vote
Answer accepted
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2018
Robert E_ Schneider October 22, 2018

Hi Gonchik,

thank you for your advice! Unfortunately I have absolutely no experience with Python, haven't even written a "Hello World", yet.
I have installed Python and the addtlassian-python-api on my PC and I tried to copy past the example into IDLE and run it. But I am getting all kinds of errors that I do not understand.

Would it be possible to supply me with a ready to go example? Something that I can just copy-paste into a file, edit URL, user, password (we're on a Confluence Cloud account, here) and run?

That would be great!

Thanks
Robert

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2018

Hi Robert, 

Let's follow using this command:

1. 

git clone https://github.com/atlassian-api/atlassian-python-api.git

2. Then goto directory with examples: 

https://github.com/atlassian-api/atlassian-python-api/blob/master/examples/confluence-check-unknown-attachment-error.py

3. Set the url and login, password. 

4. run using command line like 

python confluence-check-unknown-attachment-error.py

Hope it helps.

 

Or you can download pycharm. Community edition is enough. Than run example using button play.,

 

Hope it helps

 

Cheers,

Gonchik Tsymzhitov

Like Grigory Salnikov likes this
0 votes
Robert E_ Schneider October 22, 2018

Hi Gonchik,

I've gotten a bit further!

I change the URL to

url='https://toolmaker.atlassian.net/wiki',

and now the program happily starts.

It leaves me with this log:

Start review ~259731369 space
Extracted all pages excluding restricts
Start review pages 22 in ~259731369
Traceback (most recent call last):
  File "C:\TEMP\CflFindUnknownAttachments.py", line 51, in <module>
    check_unknown_attachment_in_space(confluence, space['key'])
  File "C:\TEMP\CflFindUnknownAttachments.py", line 42, in check_unknown_attachment_in_space
    link = confluence.has_unknown_attachment_error(page_id)
AttributeError: 'Confluence' object has no attribute 'has_unknown_attachment_error'

 does that mean that there are no unknown attachments in my spaces?

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2018

Hi Robert, 

it means you have been used old version of atlassian-python-api. 

if you using python3

pip3 install --upgrade atlassian-python-api

or pip for python2

pip install --upgrade atlassian-python-api 

 

Because I see you have been used library before upgraded on pypi mirror:) 

You are very fast:) 

 

Cheers,

Gonchik Tsymzhitov

Robert E_ Schneider October 22, 2018

Hi Gonchik,

yes, that did the trick! I am indeed using Python 3 (downloaded and installed "python-3.7.1.exe" yesterday).
The funny thing is: after the installation the system did hint me that an updated was available and even gave me the command to install that update. Unfortunately that command ran "pip install..." instead of "pip3 install...". I ran the "pip install.." but that obviously was not sufficient :-(

After running the command that you recommended "pip3 install..." the program only gives me blue messages and seems to becoming to a regular end.

 

[..]
Start review xxxx space
Extracted all pages excluding restricts
Start reveiw pages 15 in xxxx
[..]

 

Looks to me as if the space xxxx has 15 pages and they are all ok, right?

Then there is:

Start review yyyy space
Extracted all pages excluding restricts
Start review pages 241 in yyyy
[..followed by a number of urls]

The urls listed are the ones with unknown attachments that I should take care of, now, right?

In this case, we can close this ticket.

Many thanks for your help and your patience with me!!

Best regards

Robert

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2018

Hi! 

 

if you think it is okay then you can click accept answer under my answer. :)

Many thanks

 

Cheers,

Gonchik Tsymzhitov

0 votes
Robert E_ Schneider October 22, 2018

Hi Gonchik,
sadly I don't have git on my PC, so I couldn't execute that "git clone..." command. But I believe that I have the API set available anyway.

I copied the code into Python's IDLE and ran it using F5 (after changing URL, user, and pwd).

When I press F5 I get this in my IDLE-window:

Received: 404
 Not Found
Traceback (most recent call last):
  File "C:\TEMP\CflFindUnknownAttachments.py", line 49, in <module>
    for space in space_list:
TypeError: 'NoneType' object is not iterable

Line 49 runs:
   for space in space_list:
        print("Start review {} space".format(space['key']))
        check_unknown_attachment_in_space(confluence, space['key'])

 

I've entered this for the url:

url='https://toolmaker.atlassian.net',

Isn't that correct?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events