dubravcik / pbixrefresher-python

Refresh Power BI reports programmatically for free
MIT License
125 stars 55 forks source link

Save doesn't work and therefore no publishing. #21

Open ghost opened 5 years ago

ghost commented 5 years ago

I want to use pbixrefresher but I am having a problem. Pbixrefresher stops at “Do you want to save your changes?”. This is during the step “Publish”.

When using –no-publish, it seems to work but it doesn’t actually save. The save date of the file doesn't change and contents are old. (See log below). My conclusion is that save is not working, therefore I get the question: “Do you want to save your changes?” when it tries to publish.

Log:

C:\WINDOWS\system32>pbixrefresher C:\Temp\Empty.pbix
Starting Power BI
Waiting  15 sec
Identifying Power BI window
Refreshing
Waiting for refresh end (timeout in  30000 sec)
Saving
Publish
Traceback (most recent call last):
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\application.py", line 256, in __resolve_control
    criteria)
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
    raise err
pywinauto.timings.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\me\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\me\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\me\AppData\Local\Programs\Python\Python37\Scripts\pbixrefresher.exe\__main__.py", line 9, in <module>
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pbixrefresher\pbixrefresher.py", line 77, in main
    publish_dialog.child_window(title = WORKSPACE).click_input()
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\application.py", line 362, in __getattribute__
    ctrls = self.__resolve_control(self.criteria)
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\application.py", line 259, in __resolve_control
    raise e.original_exception
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
    func_val = func(*args, **kwargs)
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\application.py", line 220, in __get_ctrl
    ctrl = self.backend.generic_wrapper_class(findwindows.find_element(**ctrl_criteria))
  File "c:\users\me\appdata\local\programs\python\python37\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element
    raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'auto_id': 'KoPublishToGroupDialog', 'top_level_only': False, 'parent': <uia_element_info.UIAElementInfo - 'Empty - Power BI Desktop', WindowsForms10.Window.8.app.0.3c73ab4_r12_ad1, 1770854>, 'backend': 'uia'}

When using –no-publish, it seems to work but it doesn’t save. The save date of the file didn’t change and contents are old.

C:\WINDOWS\system32>pbixrefresher C:\Temp\Empty.pbix --no-publish
Starting Power BI
Waiting  15 sec
Identifying Power BI window
Refreshing
Waiting for refresh end (timeout in  30000 sec)
Saving
Exiting

Versions used: PBI: Version: 2.71.5523.941 64-bit (juli 2019) Python version: python-3.7.4-amd64 (clean install, only pbixrefresher) Windows 10 1809 (on a VM) Pbixrefresher .18 (latest as of 1-aug-2019) CMD as admin

Other options tried: -- init-wait 30 (PBI takes 20 sec to start) -- refresh-timeout 30

LevonPython commented 4 years ago

You can try this way, it is quite simple. https://github.com/LevonPython/PbiRefresher