Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ubuntu] Screenshots not working #43

Closed
rominail opened this issue Apr 27, 2023 · 6 comments · Fixed by #45
Closed

[ubuntu] Screenshots not working #43

rominail opened this issue Apr 27, 2023 · 6 comments · Fixed by #45
Labels

Comments

@rominail
Copy link
Contributor

I checked if pombo was running correctly, it's almost working except the screenshot part.
After looking through the code I might figured out the problem :
In the screenshot function of the final binary the "%d" seems not to be replaced by anything and then the % symbol pose problem for zipping (hence not zipped)
I replaced the code by the code below which seems to work after reading the mss documentation at https://python-mss.readthedocs.io/api.html?highlight=save#mss.base.MSSBase.save
(There is probably a way to make the code cleaner, I'm not really good in python)

filepath = "{}_screenshot".format(os.path.join(temp, filename))
filepath = filepath + "_{mon}.png"

Details :
Pombo 1.1b1
I am using Python 3.10.6
& MSS 7.0.1
& IPy 1.01
& request 2.25.1
On Ubuntu 22.04.2 LTS

I can give more informations if needed

@BoboTiG
Copy link
Owner

BoboTiG commented Apr 28, 2023

Oh you're right!

Can you confirm it works when you just change that line:

pombo/pombo.py

Line 604 in d4adb06

filepath = "{}_screenshot-%d.png".format(os.path.join(temp, filename))

to

 filepath = f"{os.path.join(temp, filename)}_screenshot-{mon}.png"

?

@BoboTiG BoboTiG added the bug label Apr 28, 2023
@rominail
Copy link
Contributor Author

Running with sudo pombo check :

name 'mon' is not defined
Traceback (most recent call last):
  File "/usr/local/bin/pombo", line 1078, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/bin/pombo", line 1065, in main
    pombo.work()
  File "/usr/local/bin/pombo", line 880, in work
    self.snapshot(current_ip)
  File "/usr/local/bin/pombo", line 662, in snapshot
    filestozip.extend(self.screenshot(report_name))
  File "/usr/local/bin/pombo", line 604, in screenshot
    filepath = f"{os.path.join(temp, filename)}_screenshot-{mon}.png"
NameError: name 'mon' is not defined. Did you mean: 'min'?

@BoboTiG
Copy link
Owner

BoboTiG commented Apr 28, 2023

My bad, it I forgot to escape:

 filepath = f"{os.path.join(temp, filename)}_screenshot-{{mon}}.png"

@rominail
Copy link
Contributor Author

It works! ;)
Thank you

@BoboTiG BoboTiG reopened this Apr 28, 2023
@BoboTiG
Copy link
Owner

BoboTiG commented Apr 28, 2023

I'll need to fix the code directly.
If you want to give a try, I'll be happy to merge a pull request ;)

@rominail
Copy link
Contributor Author

I opened a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants