py2cytoscape <Response [500]> 500

111 views
Skip to first unread message

wonderful

unread,
Jul 31, 2018, 7:24:26 PM7/31/18
to cytoscape-helpdesk
Dear all:

When I followed the py2cytoscape_Home to practice, it raised an error.
please help me
thank you




>>> from py2cytoscape import cyrest
>>> cytoscape = cyrest.cyclient()
>>> cytoscape.result()

<Response [500]> 500
b'{\n "data": {"file":"C:\\\\Users\\\\wdech\\\\AppData\\\\Local\\\\Temp\\\\C:\\\\Users\\\\wdech\\\\AppData\\\\Local\\\\Temp\\\\tmpq3k3laoa.png"},\n "errors":[{"status":500,"type":"urn:cytoscape:ci:cyrest-core:v1:handle-json-command:errors:2","message":"C:\\\\Users\\\\wdech\\\\AppData\\\\Local\\\\Temp\\\\C:\\\\Users\\\\wdech\\\\AppData\\\\Local\\\\Temp\\\\tmpq3k3laoa.png (\xe6\x96\x87\xe4\xbb\xb6\xe5\x90\x8d\xe3\x80\x81\xe7\x9b\xae\xe5\xbd\x95\xe5\x90\x8d\xe6\x88\x96\xe5\x8d\xb7\xe6\xa0\x87\xe8\xaf\xad\xe6\xb3\x95\xe4\xb8\x8d\xe6\xad\xa3\xe7\xa1\xae\xe3\x80\x82)","link":"file:/C:/Users/wdech/CytoscapeConfiguration/3/framework-cytoscape.log"}]\n}'

Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
cytoscape.result()
File "D:\PYTHON\lib\site-packages\py2cytoscape\cyrest\cyrest.py", line 110, in result
response=api("view", "export" , {"options":filetype,"OutputFile":outfile}, host=host,port=port,version=version,verbose=verbose)
File "D:\PYTHON\lib\site-packages\py2cytoscape\cyrest\base.py", line 149, in api
raise ValueError(res["errors"][0])
ValueError: {'status': 500, 'type': 'urn:cytoscape:ci:cyrest-core:v1:handle-json-command:errors:2', 'message': 'C:\\Users\\wdech\\AppData\\Local\\Temp\\C:\\Users\\wdech\\AppData\\Local\\Temp\\tmpq3k3laoa.png ', 'link': 'file:/C:/Users/wdech/CytoscapeConfiguration/3/framework-cytoscape.log'}

David Otasek

unread,
Aug 1, 2018, 5:30:38 PM8/1/18
to cytoscape-helpdesk
Hello,

I would need some more information on the script you are trying to run.

If I had to make a quick guess from the error you've sent us, it looks
like your file path is incorrect. The printout appears to show the
path, including the drive letter, is repeated twice before it gets to
the image file:
"'C:\\Users\\wdech\\AppData\\Local\\Temp\\C:\\Users\\wdech\\AppData\\Local\\Temp\\tmpq3k3laoa.png".
Removing the repeated path might help.

Let me know if this helps. If it doesn't, the source of your script
would be helpful to figure out the problem.
> --
> You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
> To post to this group, send email to cytoscape...@googlegroups.com.
> Visit this group at https://groups.google.com/group/cytoscape-helpdesk.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cytoscape-helpdesk/7c958ee9-1081-43a1-b188-1d30bada6606%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

e9258...@gmail.com

unread,
Aug 1, 2018, 11:01:17 PM8/1/18
to cytoscape-helpdesk
在 2018年8月2日星期四 UTC+8上午5:30:38,David Otasek写道:
Thank you for your advice, but I still can't figure it out.
My source code is simple, just the same as

https://py2cytoscape.readthedocs.io/en/latest/cyrest/#cyclientresult

My OS is Win10, python version is 3.6.4(64-bit)

Thank you

David Otasek

unread,
Aug 31, 2018, 11:39:15 AM8/31/18
to cytoscape-helpdesk
Apologies for the delay.

I can replicate the same error on my system; I'm contacting the py2cytoscape team with this. It seems pretty important as it's also part of the documentation: (link)  Have you had success with other py2cytoscape functionality?

The process (with Cytoscape open, and a graph view selected from galFiltered.cys) and results I got are as follows:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> from py2cytoscape import cyrest
>>> cytoscape = cyrest.cyclient()
>>> cytoscape.result()
>>> cytoscape.result()
<Response [500]> 500
b'{\n "data": {"file":"C:\\\\Users\\\\DOTASE~1\\\\AppData\\\\Local\\\\Temp\\\\C:\\\\Users\\\\DOTASE~1\\\\AppData\\\\Local\\\\Temp\\\\tmpf6lpqnhz.png"},\n "errors":[{"status":500,"type":"urn:cytoscape:ci:cyrest-core:v1:handle-json-command:errors:2","message":"C:\\\\Users\\\\DOTASE~1\\\\AppData\\\\Local\\\\Temp\\\\C:\\\\Users\\\\DOTASE~1\\\\AppData\\\\Local\\\\Temp\\\\tmpf6lpqnhz.png (The filename, directory name, or volume label syntax is incorrect)","link":"file:/C:/Users/D%20Otasek/CytoscapeConfiguration/3/framework-cytoscape.log"}]\n}'

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\D Otasek\AppData\Local\Programs\Python\Python37\lib\site-packages\py2cytoscape\cyrest\cyrest.py", line 110, in result

    response=api("view", "export" , {"options":filetype,"OutputFile":outfile}, host=host,port=port,version=version,verbose=verbose)
  File "C:\Users\D Otasek\AppData\Local\Programs\Python\Python37\lib\site-packages\py2cytoscape\cyrest\base.py", line 149, in api

    raise ValueError(res["errors"][0])
ValueError: {'status': 500, 'type': 'urn:cytoscape:ci:cyrest-core:v1:handle-json-command:errors:2', 'message': 'C:\\Users\\DOTASE~1\\AppData\\Local\\Temp\\C:\\Users\\DOTASE~1\\AppData\\Local\\Temp\\tmpf6lpqnhz.png (The filename, directory name, or volume label syntax is incorrect)', 'link': 'file:/C:/Users/D%20Otasek/CytoscapeConfiguration/3/framework-cytoscape.log'}

jbo...@googlemail.com

unread,
Sep 3, 2018, 4:52:26 AM9/3/18
to cytoscape-helpdesk
Hi Wonderful,

this is because you are trying to load a result from Cytoscape although you don't have any network selected in cytoscape.

Try loading a network and selecting before running the commands. The best would be to do if from a notebook, eg. https://github.com/cytoscape/cytoscape-automation/blob/master/for-scripters/Python/advanced-cancer-networks-and-data.ipynb

Best,

Jorge

e9258...@gmail.com

unread,
Sep 4, 2018, 4:05:59 AM9/4/18
to cytoscape-helpdesk
在 2018年9月3日星期一 UTC+8下午4:52:26,Jorge Boucas写道:
Thank you, this helps me a lot
Wish you all the best,

Wonderful

e9258...@gmail.com

unread,
Sep 4, 2018, 4:12:58 AM9/4/18
to cytoscape-helpdesk
在 2018年8月31日星期五 UTC+8下午11:39:15,David Otasek写道:
Thank you for you work
Wish you all the best

Wonderful

mgruzy

unread,
Jan 28, 2019, 6:29:56 PM1/28/19
to cytoscape-helpdesk
I am also having the hardest trouble with this issue on saving the current view, I have tried to follow the above ipynb, but still getting the very same error. My code is below:

from py2cytoscape import cyrest

cytoscape = cyrest.cyclient()
cytoscape.network.load_file("FILENAME.cyjs")
cytoscape.network.set_current(network="FILENAME")
cytoscape.layout.apply_preferred()
cytoscape.view.set_current(network="FILENAME")
cytoscape.view.fit_content()
cytoscape.network.deselect(nodeList='all', edgeList='all')
cytoscape.view.export(options="PDF", OutputFile="FILENAME_out")
Reply all
Reply to author
Forward
0 new messages