evereux / pycatia-tools

A web based GUI application to interface with CATIA V5
MIT License
1 stars 0 forks source link

500 internal server error #2

Open Fi-tz opened 2 months ago

Fi-tz commented 2 months ago

evereux edit:

Missing details from details provided in posts below.

Server message:

500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

System versions:

evereux commented 2 months ago

My first thought is that you don't have CATIA V5 running, which if this was the case, is what it would say on the 500 error page:

500 Internal Server Error: Could not access COM object. Is CATIA V5 running? 

Can you provide more information please.

Fi-tz commented 2 months ago

I run my catia application at first,the run pycatia tool ,at this moment,“cmd” pop out,and I got this link(http://127.0.0.1:5578 and I click the link combined with control key and the web shows this notice

Fi-tz commented 2 months ago

image As this picture

Fi-tz commented 2 months ago

Bro,do you have any idea?

evereux commented 2 months ago

Hmm. Can't think what would have caused that. Can you provide the full traceback (error log) from the terminal window.

Also, what version of python are you using and what version of CATIA V5?

Should be able to figure it out with this information.

Fi-tz commented 2 months ago

image image image

The version of apps concerned with this issue just uploaded,bro ,could you figure this out ?!

evereux commented 2 months ago

Please don't post pictures when text will suffice. 😃

I suspect the problem here is that the COM server hasn't been registered. This can happen due to the installation process missing this step (no idea why, but I have seen this happen) or you're using a portable version that doesn't do this.

To fix this you can either:

Fi-tz commented 2 months ago

Okay,next time i would try only texts ,and I will check the method you mentioned later and I will let you know result,thx for replying!

Fi-tz commented 2 months ago

Hey Bro,after i did this Suggestion [3,General]: 找不到命令 cnext.exe,但它确实存在于当前位置。默认情况下,Windows PowerShell 不会从当前位置加载 命令。如果信任此命令,请改为键入“.\cnext.exe”。有关详细信息,请参阅 "get-help about_Command_Precedence"。 PS D:\Program Files\Dassault Systemes\B26\win_b64\code\bin> .\cnext.exe /regserver PS D:\Program Files\Dassault Systemes\B26\win_b64\code\bin>

and i tried to open pycaita-tool ,yet it still not work ,by the way ,i didn`t clear how to specify this step "2. run the following command after replacing and with the appropriate values: cnext.exe /regserver -env -direnv " could you give me a example what the exactly command that i should type into the "cmd" window is

[2024-09-05 21:29:56,977] ERROR in app: Exception on /htmx/document/object [GET] Traceback (most recent call last): File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\win32com\client\dynamic.py", line 84, in _GetGoodDispatch pywintypes.com_error: (-2147221005, '无效的类字符串', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\flask\app.py", line 1473, in wsgi_app File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\flask\app.py", line 882, in full_dispatch_request File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\flask\app.py", line 0, in handle_user_exception File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\flask\app.py", line 880, in full_dispatch_request File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\flask\app.py", line 865, in dispatch_request File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\application\views\htmx\document_queries.py", line 19, in htmx_document_object File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\application\pycatia_scripts\the_document.py", line 22, in init File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\application\pycatia_scripts\com_objects.py", line 32, in get_app_object File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\pycatia\base_interfaces\base_application.py", line 12, in catia_application File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\win32com\client__init__.py", line 118, in Dispatch File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\win32com\client\dynamic.py", line 104, in _GetGoodDispatchAndUserName File "C:\Users\Jaqen\Desktop\PYCATI~1.1DE\PYCATI~1.1DE\win32com\client\dynamic.py", line 86, in _GetGoodDispatch pywintypes.com_error: (-2147221005, '无效的类字符串', None, None) 127.0.0.1 - - [05/Sep/2024 21:29:56] "GET /htmx/document/object HTTP/1.1" 500 -

evereux commented 2 months ago
PS D:\Program Files\Dassault Systemes\B26\win_b64\code\bin> .\cnext.exe /regserver

This is correct.

Might be worth rebooting the PC so Windows properly reloads the registry changes.

Also, search your registry for the string 'CATIA.Application' to make sure it exists. Should do now though.

2024-09-05 15_31_06-500 internal server error · Issue #2 · evereux_pycatia-tools — Mozilla Firefox

The error you're getting is related to pycatia trying to initialise the COM interface, not with pycatia-tools itself.

Try the following to prove this:

PS C:\Users\evereux\github\pycatia-tools> .\env\Scripts\activate
(env) PS C:\Users\evereux\github\pycatia-tools> python
Python 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pycatia import catia
>>> caa = catia()
>>>

This should throw the same base error. I don't know why though. 🤷 Might be worth posting to the pycatia github repository if this is the case as it'll get more visibility there.