Closed kurolneko closed 1 year ago
This message suggest that you have to start Zotero first before you click any buttons. BTW, this addon works with native Zotero installation only, not through your online account.
sorry, but I don't know what native Zotero is. I downloaded Zotero on the website: https://www.zotero.org/download/. After that, I clicked on the normal installation as the app recommended. I have uninstalled Zotero and installed it again. Then I started Zotero first before opening the WPS doc like you said. However, the problem persists. Do you have other suggestions?
You can check if the process "proxy.py" is running or not in task manager. Kill it and restart everything. If the problem persists, please upload the log file "%APPDATA%\kingsoft\wps\jsaddons\wps-zotero-proxy.log" so I can examine the problem.
I forgot that windows task manager can't really do that. Sorry, you will have to query for the prox.py process using these commands in PowerShell since you are on Windows:
$pys = get-wmiobject Win32_process -filter "Name='python.exe'"
$pys.CommandLine
This will give you a list of python processes, you can check if there's one with the name 'proxy.py'.
I paste your command in power shell but nothing happens. I still have Zotero and WPS on
I paste your command in power shell but nothing happens. I still have Zotero and WPS on
You should restart your computer and do the following again: start Zotero, start WPS -> try the buttons -> check if proxy.py is running -> restart prox.py -> upload the log file if it exists.
I did all the thing you said up to the proxy checking step, I pasted your commands in Power shell but nothing happens
How about the log file?
Sorry for the long wait, can you instruct me how to get the log files you need?
Open file explorer and paste this line to the address box:
%APPDATA%\kingsoft\wps\jsaddons
Then you should be able to see a file named 'wps-zotero-proxy.log'.
wps-zotero-proxy.log here you go
wps-zotero-proxy.log here you go
The log file is empty, not even showing the message "proxy started!". It appears the addon did try to launch the proxy server, but the proxy server failed instantly. My best guess is that you have another program listening on the port we use, 21931.
You should confirm that the proxy server really is NOT running by executing the two lines I gave you in Powershell. If the result is empty, you should try these lines in Powershell:
Get-Process -Id (Get-NetTCPConnection -LocalPort 21931).OwningProcess
Get-Process -Id (Get-NetUDPEndpoint -LocalPort 21931).OwningProcess
This will give you the program that occupies our port. If the result is empty you should run:
cd [The path to 'proxy.py' in the unzipped repo, don't include the square brackets]
python proxy.py
This will manually launch the proxy server, and you can copy paste the error message so I can diagnost the problem.
I entered: "C:\Windows\system32>cd C:\Users\Dell XPS\Downloads\WPS-Zotero-main\WPS-Zotero-main\proxy.py" , but the cmd program keeps sending me the error: "the directory is invalid". Then I hit python proxy.py, it returned: "python: can't open file 'C:\Windows\system32\proxy.py': [Errno 2] No such file or directory"
Your path contain spaces, quote it like this “D:\hello windows\file.txt”
— Reply to this email directly, view it on GitHubhttps://github.com/tankwyn/WPS-Zotero/issues/11#issuecomment-1798033587, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADK37USLYLTYR7AYK6PBJGTYDHW3BAVCNFSM6AAAAAA7AOB56WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJYGAZTGNJYG4. You are receiving this because you commented.Message ID: @.***>
sorry but same result
Your path contain spaces, quote it like this “D:\hello windows\file.txt” — Reply to this email directly, view it on GitHub<#11 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADK37USLYLTYR7AYK6PBJGTYDHW3BAVCNFSM6AAAAAA7AOB56WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJYGAZTGNJYG4. You are receiving this because you commented.Message ID: @.***>
is there another way ?
is there another way ?
You can input "python " followed by a space then drag and release the file "proxy.py" from explorer to terminal, this way the path will be automatically corrected.
is there another way ?
You can input "python " followed by a space then drag and release the file "proxy.py" from explorer to terminal, this way the path will be automatically corrected.
I can't do that, even when I opened cmd as administrator. I tried to drag other files but nothing worked
okay, I used windows Powershell and it popped up a window like this
Your picture is not uploaded correctly. @kurolneko
You can copy the file "proxy.py" to the root of D: driver, then open cmd.exe, input "python D:\proxy.py" and hit enter. Look at the cmd window that you input the commands, to see if there's any message. If not, check the log file again.
here is the log file
Dont' close the command window. Open a new cmd.exe window and check if the port is binded by proxy.py:
Get-Process -Id (Get-NetTCPConnection -LocalPort 21931).OwningProcess
Get-Process -Id (Get-NetUDPEndpoint -LocalPort 21931).OwningProcess
If so, go test the buttons in WPS.
here is what i get after pasting the codes in cmd
here is what i get after pasting the codes in cmd
My mistake, you need to put these in Powershell.
is this OK?
Yes, please proceed to test in WPS
The problem is still there
Is zotero running? If so please also check if the port 23119 is binded.
And of course you need to allow Zotero and proxy.py to access network.
the port is 23119?
changel "logging.INFO" to "logging.DEBUG" in line 164 of proxy.py. Kill all python process in task manager and restart wps and zotero. Then test again and upload the log file
I did what you told me
Here's what we know by now, we've checked that the proxy server and the Zotero server are all running correctly, and the GUI can communicate with the proxy server. However, the log file still shows the proxy cannot connect to Zotero. So I'm confident you must have declined the permission for python3 or the proxy.py script to access network, you will have to find out where and how this was done and undo it.
I find that your python version is actually not the latest. You can uninstall the old version and install 3.12 to see if this helps or not. If you have anti-virus software installed you can try quit it temporarily to see if that is the culprit. Then you can check in Windows firewall settings which you can google for how-to.
BTW, I just added more description for the connection error in proxy.py. You can kill all python processes in task manager, download the new repo, modify the log level to logging.DEBUG, and reinstall the addon. Then test the buttons and check the log file, it will give you more detail about why the proxy server failed to connect to Zotero.
I have installed python 3.12, downloaded the new repo, modify the log file to logging.DEBUG, then checked the buttons. I checked the log files, but it wouldn't show any new lines after the lines from this morning
You need to kill the python processes for the proxy won't be closed by quitting WPS due to a bug of the WPS JSAPI. If the old version is still running, the newer one won't replace it.
You need to kill the python processes for the proxy won't be closed by quitting WPS due to a bug of the WPS JSAPI. If the old version is still running, the newer one won't replace it.
I don't know how to kill all python processes by using the task manager so I restarted the computer. I did not solve the problem
You need to kill the python processes for the proxy won't be closed by quitting WPS due to a bug of the WPS JSAPI. If the old version is still running, the newer one won't replace it.
I don't know how to kill all python processes by using the task manager so I restarted the computer. I did not solve the problem
There should be such a line in proxy.py now:
logging.debug("Failed to connect to Zotero: {}".format(e))
If this is the case, there will be a line showing you the error in the log file.
you mean these lines? forward.connect(('127.0.0.1', ZOTERO_PORT)) except socket.error as e: logging.warning("Cannot connect to Zotero, is the app started?") logging.debug("Failed to connect to Zotero: {}".format(e)) forward.close()
return
self.input_list.append(forward)
self.channels[clientsock] = forward
self.channels[forward] = clientsock
in the proxy.py file, there is that line, but in the log file, the content is still the same since 11 AM this morning
I'll tell you how the whole thing works so you can find out exactly where goes wrong.
When you open a document in WPS, the addon gets loaded if it's not loaded already. Then it will try to launch the proxy server (proxy.py) listening on 127.0.0.1:21931. The proxy server will try to bind to 21931 and it will quit immediately if the port is already binded (like when there's already an instance of proxy.py running). When you click a button, it will send the requests to the proxy, and the proxy will send the requests to the Zotero server listening on 127.0.0.1:23119. The response from the Zotero server will then be send back to the addon in WPS. So the addon will know how to make changes to the document. When you quit WPS, the addon will (should) quit the proxy server. But on Windows this won't happen because the WPS JSAPI is buggy. So you might need to manually kill the proxy process if it's in an erroneous state or you want to update the file proxy.py.
There's two things you need to pay attention to. One is to check if the proxy server has been automatically started or not. The other is to check if the proxy server can reach to the Zotero server.
The addon installs to this path: "%APPDATA%\kingsoft\wps\jsaddons". If the updates in proxy.py is not working you must ensure that the file located in that place is really the latest version. And you need to make sure the currently running instance is the latest version.
I just tested on my laptop with Win10 and it works correctly. WPS version is 12.2.0.13266. Zotero is on 6.0.27. Python version is 3.11.4.
I just tested on my laptop with Win10 and it works correctly. WPS version is 12.2.0.13266. Zotero is on 6.0.27. Python version is 3.11.4.
I uninstalled all of them: wps, zotero, the repo. Then I installed them again. But the problem is still there. Can you please help me through teamviewer. Here is my email: ngotranhoangquan@gmail.com
I'm afraid I don't have the time and energy for this. But I'll give you some advices. 1) Don't use the Python from Microsoft Store, uninstall it and all Python installtions on your computer and download it from the official website. 2) Google for "windows allow network access" and grant permission for all softwares involved, WPS, Zotero and Python. 3) Eliminate the possible interference from anti-virus softwares. 4) Understand how the thing works, it's not that hard.
Finally, it worked:
Hi, I just downloaded the repository, unzipped the file, and ran the install file. I have the latest version of both WPS and Python 3. I'm currently running on Win 10. Do you have any suggestions as to why this error popped up? Thanks in advance