DB Changes Through Python Script

I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that? 



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that?



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF182BYO_2mobD%3DLXo8iFAVHyTq2AYm8ZuAQND6f3NoDbA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Cool, thanks! I'm guessing this gets run automatically when running from the site, so I don't need to do it when handling HTTP requests.

On Wednesday, August 13, 2014 2:29:03 PM UTC+5:30, Anand Doshi wrote:
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that? 



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f0bf1283-63ab-4982-a89b-09552499c076%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

Cool, thanks! I'm guessing this gets run automatically when running from the site, so I don't need to do it when handling HTTP requests.

Commits happen on "POST" / "PUT" requests only!


On Wednesday, August 13, 2014 2:29:03 PM UTC+5:30, Anand Doshi wrote:
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that? 



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.





Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f0bf1283-63ab-4982-a89b-09552499c076%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4BBA8123-2BE0-445D-92FC-5FAEF3FBE4D7%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Cool, thanks for the pointers. I've got an external script, import_data.py, which uses the frappe object and is meant to be executed in the python terminal for my site. When I execute `env/bin/python import_data.py` I get the error

NameError: name 'frappe' is not defined

How do I import the frappe object from my external script, as well as set the site? Thanks.


Brendan Kiu


On Wed, Aug 13, 2014 at 3:08 PM, Rushabh Mehta <rm...@gmail.com> wrote:

Cool, thanks! I'm guessing this gets run automatically when running from the site, so I don't need to do it when handling HTTP requests.

Commits happen on "POST" / "PUT" requests only!


On Wednesday, August 13, 2014 2:29:03 PM UTC+5:30, Anand Doshi wrote:
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that?



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.





Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.




Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/uQI-jMQDXTA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4BBA8123-2BE0-445D-92FC-5FAEF3FBE4D7%40gmail.com.


For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAOSsix%3D%2BCXNxAUdSSQsJmexpWdDpNiOfUiDsKJCYAprROzo%3DNA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
well you need to activate bench environment to access frappe.
Go to frappe-bench and run:
. ./env/bin/activate

Then run your script and you should be able to access frappe.


-Anand.


On Wed, Aug 13, 2014 at 5:29 PM, Brendan Q <br…@gmail.com> wrote:
Cool, thanks for the pointers. I've got an external script, import_data.py, which uses the frappe object and is meant to be executed in the python terminal for my site. When I execute `env/bin/python import_data.py` I get the error

NameError: name 'frappe' is not defined

How do I import the frappe object from my external script, as well as set the site? Thanks.


Brendan Kiu


On Wed, Aug 13, 2014 at 3:08 PM, Rushabh Mehta <rm...@gmail.com> wrote:

Cool, thanks! I'm guessing this gets run automatically when running from the site, so I don't need to do it when handling HTTP requests.

Commits happen on "POST" / "PUT" requests only!


On Wednesday, August 13, 2014 2:29:03 PM UTC+5:30, Anand Doshi wrote:
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that?



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.





Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.




Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/uQI-jMQDXTA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4BBA8123-2BE0-445D-92FC-5FAEF3FBE4D7%40gmail.com.


For more options, visit https://groups.google.com/d/optout.



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAOSsix%3D%2BCXNxAUdSSQsJmexpWdDpNiOfUiDsKJCYAprROzo%3DNA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.




Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF2s5bgXSM7V9B4cVSbpXkT-RMx5i5w9KrC4pqtCA%2BO_Sg%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Yep, that worked for me. What's the method to bind the script to a certain site? I get this error now:

raise RuntimeError('no object bound to %s' % self.__name__)

RuntimeError: no object bound to session

In my script I don't specify which site to use, so I'm guessing that needs to happen before I can access the frappe.new_doc(), etc methods.


Brendan Kiu


On Wed, Aug 13, 2014 at 7:31 PM, Anand Doshi <an...@erpnext.com> wrote:
well you need to activate bench environment to access frappe.
Go to frappe-bench and run:
. ./env/bin/activate

Then run your script and you should be able to access frappe.


-Anand.


On Wed, Aug 13, 2014 at 5:29 PM, Brendan Q <br…@gmail.com> wrote:
Cool, thanks for the pointers. I've got an external script, import_data.py, which uses the frappe object and is meant to be executed in the python terminal for my site. When I execute `env/bin/python import_data.py` I get the error

NameError: name 'frappe' is not defined

How do I import the frappe object from my external script, as well as set the site? Thanks.


Brendan Kiu


On Wed, Aug 13, 2014 at 3:08 PM, Rushabh Mehta <rm...@gmail.com> wrote:

Cool, thanks! I'm guessing this gets run automatically when running from the site, so I don't need to do it when handling HTTP requests.

Commits happen on "POST" / "PUT" requests only!


On Wednesday, August 13, 2014 2:29:03 PM UTC+5:30, Anand Doshi wrote:
Run frappe.db.commit() to commit :)

-Anand.


On Wed, Aug 13, 2014 at 1:38 PM, Brendan Kiu <br...@gmail.com> wrote:
I'm working on writing some import scripts for large datasets, and I noticed that using the python shell through `frappe [site_name] --python` doesn't actually commit database changes through frappe.insert(). I would like to put my files on the server and run my commands through the terminal. Any way I can do that?



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0a6b192-c2d1-4d25-b47b-f6527073f575%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.





Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.




Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/uQI-jMQDXTA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4BBA8123-2BE0-445D-92FC-5FAEF3FBE4D7%40gmail.com.


For more options, visit https://groups.google.com/d/optout.



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAOSsix%3D%2BCXNxAUdSSQsJmexpWdDpNiOfUiDsKJCYAprROzo%3DNA%40mail.gmail.com.


For more options, visit https://groups.google.com/d/optout.




Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/uQI-jMQDXTA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF2s5bgXSM7V9B4cVSbpXkT-RMx5i5w9KrC4pqtCA%2BO_Sg%40mail.gmail.com.


For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAOSsix%3DTD-zLAs9KvbAjymVdSmXTo%2BDL%3DvRyiRnR2LLFd%2BXpCQ%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
More specifically,

Traceback (most recent call last):                                                       

  File "import_children.py", line 84, in <module>                                        

    child = frappe.new_doc("My Doctype")                                                  

  File "/home/linuxuser/frappe-bench/apps/frappe/frappe/__init__.py", line 335, in new_do

c                                                                                        

    return get_new_doc(doctype, parent_doc, parentfield)                                 

  File "/home/linuxuser/frappe-bench/apps/frappe/frappe/model/create_new.py", line 17, in

 get_new_doc                                                                             

    "owner": frappe.session.user,                                                        

  File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 338, in __getattr__                                                           

    return getattr(self._get_current_object(), name)                                     

  File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 301, in _get_current_object                                                   

    raise RuntimeError('no object bound to %s' % self.__name__)                          

RuntimeError: no object bound to session                                                 

Thanks!



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/43c175af-940b-451a-a6af-95e44e5eeafe%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Brenden,

It would be better if you share your script on gist, so that people can comment at the appropriate place in the code.

-Anand.



On Thu, Aug 14, 2014 at 10:23 AM, Brendan Kiu <br…@gmail.com> wrote:
More specifically,

Traceback (most recent call last):

File "import_children.py", line 84, in <module>

child = frappe.new_doc("My Doctype")

File "/home/linuxuser/frappe-bench/apps/frappe/frappe/__init__.py", line 335, in new_do

c

return get_new_doc(doctype, parent_doc, parentfield)

File "/home/linuxuser/frappe-bench/apps/frappe/frappe/model/create_new.py", line 17, in

get_new_doc

"owner": frappe.session.user,

File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 338, in __getattr__

return getattr(self._get_current_object(), name)

File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 301, in _get_current_object

raise RuntimeError('no object bound to %s' % self.__name__)

RuntimeError: no object bound to session

Thanks!



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/43c175af-940b-451a-a6af-95e44e5eeafe%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF12AA5YMZ34OUgyaT6akVOzrAmQ4G5WFi_Sd_iCf0pnRA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Sure, here it is:
https://gist.github.com/bkiu/b3a835cbfd0cc41838fa

On Thursday, August 14, 2014 10:54:27 AM UTC+5:30, Anand Doshi wrote:
Hi Brenden,

It would be better if you share your script on gist, so that people can comment at the appropriate place in the code.

-Anand.



On Thu, Aug 14, 2014 at 10:23 AM, Brendan Kiu <br…@gmail.com> wrote:
More specifically,

Traceback (most recent call last):                                                       

  File "import_children.py", line 84, in <module>                                        

    child = frappe.new_doc("My Doctype")                                                  

  File "/home/linuxuser/frappe-bench/apps/frappe/frappe/__init__.py", line 335, in new_do

c                                                                                        

    return get_new_doc(doctype, parent_doc, parentfield)                                 

  File "/home/linuxuser/frappe-bench/apps/frappe/frappe/model/create_new.py", line 17, in

 get_new_doc                                                                             

    "owner": frappe.session.user,                                                        

  File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 338, in __getattr__                                                           

    return getattr(self._get_current_object(), name)                                     

  File "/home/linuxuser/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local

.py", line 301, in _get_current_object                                                   

    raise RuntimeError('no object bound to %s' % self.__name__)                          

RuntimeError: no object bound to session                                                 

Thanks!



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/43c175af-940b-451a-a6af-95e44e5eeafe%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/74efd97c-8721-4c08-b074-cba1165ba626%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Do

```
frappe.init(sitename)
frappe.connect()
```



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/cc11445c-a773-4837-b391-17ff6f59b6ed%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Yep, that worked. Thanks!

On Thursday, August 14, 2014 12:11:06 PM UTC+5:30, rushabh wrote:
Do

```
frappe.init(sitename)
frappe.connect()
```



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/cebe1221-f6b5-4ef3-bf58-689edd381554%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.