sinedie / SRTranslator

SRT files translator
Do What The F*ck You Want To Public License
207 stars 22 forks source link

New GUI Version not opening giving error #85

Open h4rdkor1 opened 7 months ago

h4rdkor1 commented 7 months ago

Hi @sinedie Thank you for creating the GUI version for all of us. I am getting error when trying to run the new GUI version of the translator but its not working. I am getting the below error.

Traceback (most recent call last): File "\app\srtranslatorGUI\__main__.py", line 1, in <module> from srtranslatorGUI.app import main File "\app\srtranslatorGUI\app.py", line 3, in <module> import toga ModuleNotFoundError: No module named 'toga' image

sinedie commented 7 months ago

Windows user? let me check

h4rdkor1 commented 7 months ago

Yes I am using windows 11

sinedie commented 7 months ago

Last release .msi updated. Close if issue solved

h4rdkor1 commented 7 months ago

Still not working giving the same error. Does this program require something to be preinstalled in order to work.

image

sinedie commented 7 months ago

The build process on windows is failing when adding app requirements. Right now I don't have the time to fix it, while I manage to fix it, try this steps to generate your own .msi file.

h4rdkor1 commented 7 months ago

Hi @sinedie, I tried to do what you said but I don't have much knowledge about phyton so cant get anywhere. If you get time to fix this I will be really grateful Thank you.

merida77 commented 7 months ago

Hi @sinedie. I don't know too. I am patiently waiting for you to hopefully solve it.

arlovibre commented 7 months ago

Hi @sinedie. I love your work. It would be awesome if you had the time to fix this. Best wishes to you, and keep up the good work! :)

k-aito commented 6 months ago

Hello @merida77 @arlovibre @h4rdkor1

I tried to add "toga" to the windows requires can you give it a try, I cannot try it myself because I don't have a windows.

master-windows-2022.msi.zip

arlovibre commented 6 months ago

There is an error again, the same one.

image

Hello @merida77 @arlovibre @h4rdkor1

I tried to add "toga" to the windows requires can you give it a try, I cannot try it myself because I don't have a windows.

master-windows-2022.msi.zip

h4rdkor1 commented 6 months ago

Hi @k-aito , Thank you for trying to fix the issue but I am still getting the same error as before.

m1nuzz commented 6 months ago

Hi @k-aito , Thank you for trying to fix the issue but I am still getting the same error as before.

same:(

k-aito commented 6 months ago

I don't have any idea...

Each I tried to add the requirement in the windows section, but normally by default they each get another GUI dependence, and it would normally bring back toga with him.

Without having windows to build or test, it's very hard.

The best would that someone with Windows and python knowledge try to follow https://github.com/sinedie/SRTranslator?tab=readme-ov-file#usage-from-gui like suggested @sinedie

k-aito commented 6 months ago

Hello @merida77 @arlovibre @h4rdkor1

I dig a bit more and I noticed an issue https://github.com/beeware/briefcase/issues/977

It looks like the linked commit is in toga 4.2 so I rebuild the 2 msi with toga 0.4.1 and toga 0.4.2 (you can see it in the zip name).

It looks like 0.4.2 has an issue with linux so I hope that 0.4.1 would be enough but we will see.

fix-import-toga-error-windows-2022-0.4.1.msi.zip

fix-import-toga-error-windows-2022-0.4.2.msi.zip

h4rdkor1 commented 6 months ago

Hi @k-aito, I tried both versions and both gave me the same toga error.

arlovibre commented 6 months ago

Hello @merida77 @arlovibre @h4rdkor1

I dig a bit more and I noticed an issue beeware/briefcase#977

It looks like the linked commit is in toga 4.2 so I rebuild the 2 msi with toga 0.4.1 and toga 0.4.2 (you can see it in the zip name).

It looks like 0.4.2 has an issue with linux so I hope that 0.4.1 would be enough but we will see.

fix-import-toga-error-windows-2022-0.4.1.msi.zip

fix-import-toga-error-windows-2022-0.4.2.msi.zip

Hello @k-aito. Thank you for trying again, I tried both versions and got the same "toga" error again.

k-aito commented 6 months ago

Hello @merida77 @arlovibre @h4rdkor1

Sorry pinging everyone again, I tried one more time this time by using the workaround of the issue.

Using the version defined in the original file but adding toga-core in each section. Let's hope it's the right one

fix-import-toga-error-windows-2022.msi.zip

arlovibre commented 6 months ago

Thank you for trying again @k-aito, but again, the same error.

image

k-aito commented 6 months ago

I have no more ideas for now sadly. It would be interesting to see if the normal briefcase process is working properly on Windows.

It would let us test it is related to briefcase directly or the packaging of briefcase but there is a need of a Windows computer for trying that sadly.

k-aito commented 6 months ago

I think I have something @sinedie

It's not very clear but if you read the CI build for windows it fails in when it install the requirements because of UnicodeEncodeError: 'charmap' codec can't encode character '\u2502' in position 2: character maps to <undefined>

I can remove the message when I'm not installing togax-xml-layout-plugin as requirement (in the pyproject file). You can maybe check if there si not a weird character somewhere that could make it fail ?

sinedie commented 6 months ago

Finally got time for this... @k-aito , ty for finding that. The issue was on togax-xml-layout requirements. It had a linux-only dependency (pygobject).

So, now the msi is updated on last relase. (Also here: master-windows-2022.msi.zip)

Close if issue is solved.

m1nuzz commented 6 months ago

Наконец-то появилось время для этого...@k-aito, спасибо, что нашел это. Проблема заключалась в требованиях к макету togax-xml. У него была зависимость только для Linux (pygobject).

Итак, теперь MSI обновлен до последней версии. (Также здесь: master-windows-2022.msi.zip )

Закройте, если проблема решена.

image

I have this error with your update

Traceback (most recent call last):
  File "\app_packages\togax_xml_layout\xml_parser.py", line 146, in parse_element
    instance = element_to_class(element.tag, attributes)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 106, in element_to_class
    instance = klass(**init_args)
  File "\app_packages\toga\widgets\activityindicator.py", line 25, in __init__
    self._impl = self.factory.ActivityIndicator(interface=self)
  File "\app_packages\toga_winforms\factory.py", line 76, in __getattr__
    raise NotImplementedError(f"Toga's Winforms backend doesn't implement {name}")
NotImplementedError: Toga's Winforms backend doesn't implement ActivityIndicator

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\app\srtranslatorGUI\__main__.py", line 4, in <module>
    main().main_loop()
  File "\app_packages\toga\app.py", line 749, in main_loop
    self._impl.main_loop()
  File "\app_packages\toga_winforms\app.py", line 284, in main_loop
    raise self._exception
  File "\app_packages\toga_winforms\app.py", line 257, in run_app
    self.create()
  File "\app_packages\toga_winforms\app.py", line 113, in create
    self.interface._startup()
  File "\app_packages\toga\app.py", line 710, in _startup
    self.startup()
  File "\app\srtranslatorGUI\app.py", line 50, in startup
    self.main_window = parse_layout(self, f.read())
  File "\app_packages\togax_xml_layout\xml_parser.py", line 158, in parse_layout
    return parse_element(app, tree)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  [Previous line repeated 1 more time]
  File "\app_packages\togax_xml_layout\xml_parser.py", line 151, in parse_element
    instance = element_to_class(element.tag, attributes)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 106, in element_to_class
    instance = klass(**init_args)
  File "\app_packages\toga\widgets\activityindicator.py", line 25, in __init__
    self._impl = self.factory.ActivityIndicator(interface=self)
  File "\app_packages\toga_winforms\factory.py", line 76, in __getattr__
    raise NotImplementedError(f"Toga's Winforms backend doesn't implement {name}")
NotImplementedError: Toga's Winforms backend doesn't implement ActivityIndicator
k-aito commented 6 months ago

Finally got time for this... @k-aito , ty for finding that. The issue was on togax-xml-layout requirements. It had a linux-only dependency (pygobject).

So, now the msi is updated on last relase. (Also here: master-windows-2022.msi.zip)

Close if issue is solved.

Perfect, I had tried some random stuff when forking but I got nowhere close ^^

Наконец-то появилось время для этого...@k-aito, спасибо, что нашел это. Проблема заключалась в требованиях к макету togax-xml. У него была зависимость только для Linux (pygobject). Итак, теперь MSI обновлен до последней версии. (Также здесь: master-windows-2022.msi.zip ) Закройте, если проблема решена.

image

I have this error with your update

Traceback (most recent call last):
  File "\app_packages\togax_xml_layout\xml_parser.py", line 146, in parse_element
    instance = element_to_class(element.tag, attributes)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 106, in element_to_class
    instance = klass(**init_args)
  File "\app_packages\toga\widgets\activityindicator.py", line 25, in __init__
    self._impl = self.factory.ActivityIndicator(interface=self)
  File "\app_packages\toga_winforms\factory.py", line 76, in __getattr__
    raise NotImplementedError(f"Toga's Winforms backend doesn't implement {name}")
NotImplementedError: Toga's Winforms backend doesn't implement ActivityIndicator

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\app\srtranslatorGUI\__main__.py", line 4, in <module>
    main().main_loop()
  File "\app_packages\toga\app.py", line 749, in main_loop
    self._impl.main_loop()
  File "\app_packages\toga_winforms\app.py", line 284, in main_loop
    raise self._exception
  File "\app_packages\toga_winforms\app.py", line 257, in run_app
    self.create()
  File "\app_packages\toga_winforms\app.py", line 113, in create
    self.interface._startup()
  File "\app_packages\toga\app.py", line 710, in _startup
    self.startup()
  File "\app\srtranslatorGUI\app.py", line 50, in startup
    self.main_window = parse_layout(self, f.read())
  File "\app_packages\togax_xml_layout\xml_parser.py", line 158, in parse_layout
    return parse_element(app, tree)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  File "\app_packages\togax_xml_layout\xml_parser.py", line 131, in parse_element
    children.append(parse_element(app, child))
  [Previous line repeated 1 more time]
  File "\app_packages\togax_xml_layout\xml_parser.py", line 151, in parse_element
    instance = element_to_class(element.tag, attributes)
  File "\app_packages\togax_xml_layout\xml_parser.py", line 106, in element_to_class
    instance = klass(**init_args)
  File "\app_packages\toga\widgets\activityindicator.py", line 25, in __init__
    self._impl = self.factory.ActivityIndicator(interface=self)
  File "\app_packages\toga_winforms\factory.py", line 76, in __getattr__
    raise NotImplementedError(f"Toga's Winforms backend doesn't implement {name}")
NotImplementedError: Toga's Winforms backend doesn't implement ActivityIndicator

That looks like an error for @sinedie because Toga doesn't implement something for Windows. Good luck @sinedie ^^

sinedie commented 6 months ago

@m1nuzz New release here got the updated msi. (with this ActivityIndicator issue fixed)

h4rdkor1 commented 6 months ago

@sinedie @k-aito , Now the application opens but it freezes when try to translate subs.

image

m1nuzz commented 6 months ago

@sinedie @k-aito , Now the application opens but it freezes when try to translate subs.

image

same

dante3732 commented 6 months ago

@sinedie @k-aito , Now the application opens but it freezes when try to translate subs.

image

Same

k-aito commented 6 months ago

Hello @h4rdkor1 @m1nuzz @dante3732

I give a try with 1 SRT (using choose file) and pydeeplx, and it works for me on Linux. Can one of you give it a try with something else than DeepL scraper?

dante3732 commented 6 months ago

Hello @h4rdkor1 @m1nuzz @dante3732

I give a try with 1 SRT (using choose file) and pydeeplx, and it works for me on Linux. Can one of you give it a try with something else than DeepL scraper?

It happened on any translator with WIN 11.

k-aito commented 6 months ago

Hello @dante3732

There is no debug information in the terminal? Maybe launching the exe from the terminal would display something as logs.

k-aito commented 6 months ago

@dante3732 it's possible that you give a try with a very small SRT, like 1 sentence. Just to be sure that it is really blocking and not just missing to display the progression.

dante3732 commented 6 months ago

it's possible that you give a try with a very small SRT, like 1 sentence. Just to be sure that it is really blocking and not just missing to display the progression.

Immediately after clicking translate, the program stops responding. I tried SRT with a single line.

Hello @dante3732

There is no debug information in the terminal? Maybe launching the exe from the terminal would display something as logs.

I do not know how to do this through the terminal.

k-aito commented 6 months ago

Hello @dante3732

Can you give a try to this one, I added asyncio as dependance.

k-aito-patch-1-windows-2022.msi.zip

dante3732 commented 6 months ago

Can you give a try to this one, I added asyncio as dependance.

Same stops responding.

k-aito commented 6 months ago

@dante3732 for launching the file from the terminal you can open a command prompt and then drag and drop the executable, maybe there will be some information.

You can start a command prompt by doing execute and typing cmd if I recall correctly.

dante3732 commented 6 months ago

for launching the file from the terminal you can open a command prompt and then drag and drop the executable, maybe there will be some information.

When running this way, no debugging appears on the command line.

k-aito commented 6 months ago

k-aito-patch-1-windows-2022.msi.zip

@dante3732 no big change, I just removed the display of the progression, can you try again the 1 line SRT to see if it can finish?

The idea is to try to find what part of the application is freezing windows.

m1nuzz commented 6 months ago

k-aito-patch-1-windows-2022.msi.zip

@dante3732 no big change, I just removed the display of the progression, can you try again the 1 line SRT to see if it can finish?

The idea is to try to find what part of the application is freezing windows.

Tried what you said, still the app is "not responding".

dante3732 commented 6 months ago

no big change, I just removed the display of the progression, can you try again the 1 line SRT to see if it can finish?

Same stop respond.

arlovibre commented 6 months ago

k-aito-patch-1-windows-2022.msi.zip

@dante3732 no big change, I just removed the display of the progression, can you try again the 1 line SRT to see if it can finish?

The idea is to try to find what part of the application is freezing windows.

It freezes again unfortunately. Have you had any chance to look into it again?

k-aito commented 6 months ago

Hello @arlovibre

On my side without a Windows it's very difficult. For me, the command line version is working, and I don't see any reason it would hang with the GUI code that works on Linux.

Until someone that can try to build and run the briefcase version and maybe have some debug info, I think it will be difficult to fix.

k-aito commented 6 months ago

Hello @arlovibre @dante3732 @m1nuzz

I read the code again and the only thing that for me must be an issue is the async function. So I added prints and I hope that when it freezes it will show the last that worked to be certain that the error is from there.

k-aito-patch-1-windows-2022.msi(2).zip

dante3732 commented 6 months ago

Hello @arlovibre @dante3732 @m1nuzz

I read the code again and the only thing that for me must be an issue is the async function. So I added prints and I hope that when it freezes it will show the last that worked to be certain that the error is from there.

k-aito-patch-1-windows-2022.msi(2).zip

It freezes as before.

k-aito commented 6 months ago

Hello @dante3732 there are no numbers at all that are displayed at the right of the screen?

image

dante3732 commented 6 months ago

Hello @dante3732 there are no numbers at all that are displayed at the right of the screen?

image

image

k-aito commented 6 months ago

It means that the function is not even launched... Maybe it's related to the toga xml layout. I will try to see if I find something about it.

@sinedie if you have an idea what could prevent windows to launch the function don't hesitate

sinedie commented 6 months ago

Not having windows to debug is the main problem for me.

I don't think it is related with toma-xml-layout as if it didn't work app wouldn't open in first place.

Most probably it is an AsyncIO issue, maybe it is blocking the main Toga thread. Idk.

Gonna check if can get a virtual windows machine or anything and try to fix it. Dont have too many spare time lately, but will fix this for sure.

sinedie commented 5 months ago

@k-aito I can confirm the issue is with AsynIO blocking the main event loop of Toga. The issue happened to me when, inside translate function, I use any other subrutine, even with only a print statement. Still researching but right now Im lost on how to solve it.

Im seriusly thinking in switch to another GUI framework. Even with another tech stack like Tauri or NeutralinoJs

k-aito commented 5 months ago

Hello @sinedie

Only on Windows or on Linux also? I didn't let it completely translate something on Linux, but I didn't notice it was blocking.

I don't know Tauri or Nautralinojs at all but could still be fun to look at it.

sinedie commented 5 months ago

@k-aito in windows, linux works fine