Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

.onshapepy. key file location (Win vs. linux)

fluvio_lobo_fenogliettofluvio_lobo_fenoglietto Member Posts: 36 PRO
Hello,

Have there been any changes to the format and location of the .onshapepy. file for either Win or Linux.
I can execute my programs by adding the file to my C:\Users\<myusername>\.onshapepy.
But I do not seem to be able to place the file in the correct directory in Linux
So far I have tried:
  • /home/
  • /home/<username>/
  • /usr/
Tagged:

Comments

  • Ethan_KEthan_K Member, Onshape Employees Posts: 57
    Hi @fluvio_lobo_fenoglietto ,

    Please note that onshapepy is deprecated now in favor of onshape-clients [here](https://github.com/onshape-public/onshape-clients). It is still in a somewhat experimental stage, but can already do substantially more than onshapepy. If you do want to keep using onshapepy, it pulls the config from ~/.onshapepy according to the code: https://github.com/ethan92429/onshapepy/blob/master/onshapepy/core/client.py#L54. So it is wherever pathlib.Path.home() resolves to I suggest running:

    pathlib.Path.home())import pathlib
    print(
    Then put the .onshapepy file there!
  • fluvio_lobo_fenogliettofluvio_lobo_fenoglietto Member Posts: 36 PRO
    Well... I am glad I asked this question. I will try to move everything to clients.

    Thank you!
  • Ethan_KEthan_K Member, Onshape Employees Posts: 57
    Absolutely! Sorry you'll have to rewrite some of your code. I'm hoping I'll have time in the next couple of months to finish solidifying onshape-clients so you can have a more stable code base to rely upon. 
  • fluvio_lobo_fenogliettofluvio_lobo_fenoglietto Member Posts: 36 PRO
    @ethan_keller769,

    Will you guys get rid of onshapepy?
    I may jut finish-up my code and then look into translating (depending on your plans).

    Maybe could you give me some guidance for the translation.
    Below is an example of my version of an get/update configuration routine (with my imports and object definitions):
    from onshapepy.play import *<br>import json<br><br><div>part_URL&nbsp; &nbsp; = "https://cad.onshape.com/documents/{}/w/{}/e/{}".format( self.did, self.wid, self.eid )</div><div>self.myPart = Part( part_URL )&nbsp;</div><div>self.c&nbsp; &nbsp; &nbsp; = Client()&nbsp;</div><br><div>response = self.c._api.request('get','/api/partstudios/d/{}/w/{}/e/{}/configuration'.format(self.did, self.wid, self.eid))<br><br># here I make some modifications to the configurations(variables) and then push a payload that it is essentially the payload....<br><br></div>response = self.c._api.request('post','/api/partstudios/d/{}/w/{}/e/{}/configuration'.format(self.did, self.wid, self.eid),body=json.dumps(payload))&nbsp;

    I noticed, from a quick glance, that clients has simplified the syntax, so I may just need to translate the calls quickly.

  • Ethan_KEthan_K Member, Onshape Employees Posts: 57
    The new python client is still a relatively shallow wrapper on top of the API - it will be some small changes to the method calls, that call the endpoints, but nothing major. I would wait to switch over until the onshape clients are officially released. Right now they are still in beta.  
  • fluvio_lobo_fenogliettofluvio_lobo_fenoglietto Member Posts: 36 PRO
    @ethan_keller769,

    Thank you!
Sign In or Register to comment.