-
Notifications
You must be signed in to change notification settings - Fork 72
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
My code gives the error "Please check if you have Photoshop installed correctly." #161
Comments
Hi @emogothyy This API then relies on having Photoshop installed locally, If possible, please take a screenshot of your running process so that we can take a look
I checked that the dependencies between the two sides are not in conflict. |
@loonghao Thanks a lot! It really helped me to open Photoshop first with import os and then everything started working properly. I'll attach screenshots now. If necessary, I can send all the files. Thanks again |
@emogothyy # main.py
from photoshop import Session
@bot.message_handler(content_types=['text'])
def func_a(message):
if(message.text == '/ph'):
with Session() as ps:
user_info = {'test' : 'func_a'}
test_edit_text(user_info, ps_api=ps)
@bot.message_handler(content_types=['text'])
def func_b(message):
if(message.text == '/ph'):
with Session() as ps:
user_info = {'test' : 'func_b'}
test_edit_text(user_info, ps_api=ps)
# photoshop_function.py
def test_edit_text(info_from, ps_api):
try:
psApp = ps_api.Application()
psApp.Open(r"mypath\first.psd")
doc = psApp.Application.ActiveDocument
print(info_from['test'])
text_from_user = info_from['test']
layer1init = doc.ArtLayers["layer1"]
text_new_layer1 = layer1init.TextItem
text_new_layer1 .contents = f"{text_from_user .upper()}"
options = ps.JPEGSaveOptions(quality=5)
jpg = r'mypath\photo.jpg'
doc.saveAs(jpg, options, True)
except Exception as e:
print(e)
|
Hello,
I'm trying to collect information from a user using telegram chat (pyTelegramBotAPI) so I can transfer this to photoshop inside the function in the future, but when I use the bot, the code gives the error "Please check if you have Photoshop installed correctly." Although if you run the same, but not through the bot everything will run and work fine.
I tried - get a newer version of photoshop (CC2018 -> 2020), and also specify the path in the Windows environment variables. If you open photoshop using pyWin32 it works fine, but it's very unprofitable for me, I was going to use only pythonPhotoshopAPI.
Here's the function
If you run the function like this, nothing works
But if you run it like this, it works fine
Why does the code suddenly stop seeing Photoshop? Is it possible that the two libraries are incompatible?
The text was updated successfully, but these errors were encountered: