Run two Instances of OpenERP 8 - odoo

I want to run two instances of OpenERP but once the first one is running I don't know why the second one access to the files of the first one, like ir_http.py from the first one. I noticed that it changes the directory, I did some debug on the files used with no luck because somehow the second instance manages to call the first one, trying to access their directory. This is my log:
File "/home/user/lib/python2.7/Werkzeug-0.9.4-py2.7.egg/werkzeug/wsgi.py", line 579, in __call__
return self.app(environ, start_response)
File "/home/user/openerp-8.0-acmlpsc/openerp-8.0/openerp/http.py", line 1234, in dispatch
result = ir_http._dispatch()
File "/home/user/openerp-8.0/openerp/addons_test/trunk-restaurant-addons/base/ir/ir_http.py", line 106, in _dispatch
werkzeug.exceptions.Forbidden))
File "/home/user/openerp-8.0/openerp/addons_test/trunk-restaurant-addons/base/ir/ir_http.py", line 101, in _dispatch
auth_method = self._authenticate(func.routing["auth"])
File "/home/user/openerp-8.0/openerp/addons_test/trunk-restaurant-addons/base/ir/ir_http.py", line 76, in _authenticate
request.session.check_security()
File "/home/user/openerp-8.0-acmlpsc/openerp-8.0/openerp/http.py", line 801, in check_security
security.check(self.db, self.uid, self.password)
I can understand that the security check fails, because is the second instance trying to access the first one but why is the second one trying to access the first one! I don't get it.

It appears that you have two users (openerp-8.0-acmlpsc & openerp-8.0), one for each instance of OpenERP. That is correct!
Make sure that each of those users are the owners of each of their own directories (server, addons, etc)
Also make sure that each of those servers are using different configuration files. A lot of setups will put one /etc/openerp-server.conf and another in /etc/openerp-server-test.conf
They should be using different ports and own their own databases.

Related

How to have multi-page table row cells converted properly using rst2pdf Shpinx?

I have a table of which one-row cell has so much data that it could span multiple pages in the finally-generated PDF file. rst2pdf ungracefully fails when I feed it my file, with the following output:
[ERROR] pdfbuilder.py:161 Failed to build doc
Traceback (most recent call last):
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/pdfbuilder.py", line 158, in write
docwriter.write(doctree, destination)
File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 78, in write
self.translate()
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/pdfbuilder.py", line 697, in translate
createpdf.RstToPdf(
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/createpdf.py", line 689, in createPdf
pdfdoc.multiBuild(elements)
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 1167, in multiBuild
self.build(tempStory, **buildKwds)
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 1080, in build
self.handle_flowable(flowables)
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/createpdf.py", line 859, in handle_flowable
self.handle_frameEnd()
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 726, in handle_frameEnd
self.handle_pageEnd()
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 668, in handle_pageEnd
raise LayoutError(ident)
reportlab.platypus.doctemplate.LayoutError: More than 10 pages generated without content - halting layout. Likely that a flowable is too large for any frame.
FAILED
build succeeded.
and make latexpdf produce undesirable output depicted in the following screenshot.
Is there a way to remedy this problem using either latexpdf or rst2pdf? Ideally, I would like a solution that works for both spaced text (i.e. space-separated words) and consecutive, wrapped non-separated text.
This isn't the answer you want, but rst2pdf won't split the cell across pages, so if it doesn't fit onto the page, it won't be able to generate the document. The project (I'm a maintainer) is open to patches, in case you end up fixing it yourself. I'm not aware of a workaround, other than reformatting the content to be more printable.

PyAutoGui module gives PermissionError at 2nd run

I'm writing a startup script that starts and logs in on all my applications I use daily. For this I'm using the PyAutoGui module, python 3, and another application that manages the layout of my windows on my 2 monitors.
def smv(username, hotkey):
# starting application
os.system("smv.exe")
# it autofocuses on the username field
pyautogui.typewrite(username)
# (passwords are the same)
pyautogui.typewrite("PASSWORD\n")
# move to the window header (where title, minimize, close, etc..)
pyautogui.moveTo(100, 10, duration=0)
# drag the window to the far right of the primary monitor (since pyautogui doesn't support multiple monitors)
pyautogui.dragTo(1910, 20, duration=1, button="left")
# press the hotkey that belongs to the window layout manager
pyautogui.hotkey("ctrl", "alt", hotkey)
smv("username", "num7")
smv("username2", "num1")
The weird thing is that the first smv() runs perfectly fine. Application starts up, logs in, moves the window and adjusts the position/size with the hotkey.
The problem occurs when the second smv() runs. Application starts up, logs in, moves to window header, but then crashes with:
Traceback (most recent call last):
File "main.py", line 15, in <module>
smv("username2", "num1")
File "D:\files\PyCharm\startup\smv2.py", line 10, in start
pyautogui.dragTo(1919, 10, duration=1, button="left")
File "d:\PortableApps\Miniconda3\lib\site-packages\PyAutoGUI-0.9.33-py3.5.egg\pyautogui\__init__.py", line 683, in dragTo
File "d:\PortableApps\Miniconda3\lib\site-packages\PyAutoGUI-0.9.33-py3.5.egg\pyautogui\__init__.py", line 274, in mouseDown
File "d:\PortableApps\Miniconda3\lib\site-packages\PyAutoGUI-0.9.33-py3.5.egg\pyautogui\_pyautogui_win.py", line 393, in _mouseDown
File "d:\PortableApps\Miniconda3\lib\site-packages\PyAutoGUI-0.9.33-py3.5.egg\pyautogui\_pyautogui_win.py", line 480, in _sendMouseEvent
PermissionError: [WinError 5] Access denied.
I'm cracking my brain trying to figure out why it crashes at the second run.
I've tried using try and except blocks (no use), I've switched the order in which the application starts (num1 before num7 and vice versa), but no use (1st one runs, 2nd crashes).
I've even tried to split them up into 2 files and running it from a third "main.py" file. Its not efficient, I know, but wanted to see if it made any difference.. you guessed it: it doesn't. It still crashes on PermissionError.
In 0.9.34, this has been fixed (or at least, the exceptions are now suppressed since the clicks still seem to work anyway). So the solution is to upgrade PyAutoGUI.

PsychoPy - Workaround for (still ongoing) pyglet memory leak affecting text components displayed at frame-level

I too have run across the infamous pyglet memory leak, that occurs when one needs to update text components at the frame level (with a text variable typically computed in a separate code component, also at frame level).
The leak/bug crashes a running script with an error message of the sort:
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\window.py", line 541, in flip
thisStim.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py", line 603, in draw
self._pygletTextObj.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\__init__.py", line 565, in draw
self._layout.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py", line 852, in draw
self.batch.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\__init__.py", line 544, in draw
func()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\__init__.py", line 476, in <lambda>
(lambda d, m: lambda: d.draw(m))(domain, mode))
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\vertexdomain.py", line 313, in draw
glDrawArrays(mode, starts[0], sizes[0])
WindowsError: exception: access violation reading 0x00000010
Exception TypeError: "'NoneType' object is not callable" in <bound method Server.__del__ of <pyolib.server.Server object at 0x0EFB3670>> ignored
I know the PsychoPy community has linked this to a memory leak in pyglet that was meant to have been fixed around April 2016 according to this thread. I downloaded the latest version of Pyglet (which is v1.2.4 - released apparently in Sep 2015, so before the supposed fix of the leak) and replaced its contents under c:\Program Files (x86)\PsychoPy2\Lib\site-packages\pyglet\. However, this did not fix my problem.
Unfortunately, my experiment does not make sense if I give up the frame-wise computation that feeds the text component.
An older thread that I found suggested the following workaround: in the code component that computes frame-wise the value of the text variable being displayed, only assign this variable a new value if that new value actually differs from the previous value. However, even after changing my code component this way, the pyglet error still pops up.
Assuming the bug was fixed in Pyglet, is it not v1.2.4 that reflects this fix, and should it not be updated by overwriting the contents of c:\Program Files (x86)\PsychoPy2\Lib\site-packages\pyglet\ (maintaining the original folder structure)?
Assuming the bug was in fact NOT fixed in Pyglet, can anyone suggested a different workaround that I can try to make my PsychoPy expt not crash?
Many thanks indeed for your help.
(Apologies for the double post both here and on the psychopy group; will update both threads as soon as there is a response on the other, to avoid people wasting time with double answers).
One workaround is to use TextBox instead of TextStim. To do that, one first defines a stimulus object in a code component (under "begin routine"), such as
textbox = visual.TextBox(window=win,
text='Something',
font_size=21,
font_color=[-1,-1,1],
size=(1.9, .3),
pos=(0.0, 0.25),
grid_horz_justification='center',
units='norm')
then, perhaps under the "every frame" tab, one uses code to customise & call upon the thus-defined textbox, with syntax as found on http://www.psychopy.org/api/visual/textbox.html

Read the null value in Python Redmine API

Using rest API, I am connecting Redmine with Python Script and Populating the data in the ODOO.
In Redmine assigned_to value in issue is empty i.e NULL, while Reading those value.
Traceback (most recent call last):
File "/home/vignesh/PycharmProjects/vignesh/vigred.py", line 23, in <module>
redmine_asssigned_to = id.assigned_to
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 424, in __getattr__
return super(Issue, self).__getattr__(item)
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 193, in __getattr__
return self._action_if_attribute_absent()
File "/usr/local/lib/python2.7/dist-packages/python_redmine-1.5.1-py2.7.egg/redmine/resources.py", line 294, in _action_if_attribute_absent
raise ResourceAttrError
redmine.exceptions.ResourceAttrError: Resource doesn't have the requested attribute
Short answer: Use getattr(id, 'assigned_to', None) instead of id.assigned_to.
Long answer: Python-Redmine raises ResourceAttrError if you're trying to access an attribute that doesn't exist. The problem here is that assigned_to may or may not exist on the resource object depending on if it is set in Redmine or not, also Python-Redmine doesn't hardcode any attributes inside itself, i.e. it gets them dynamically from Redmine, that is why you have this problem.

Creating image retention test im builder view

I just downloaded psychopy this morning and have spent the day trying to figure out how to work with builder view. I watched the youtube video "Build your first PsychoPy experiment (Stroop task)" by Jon Pierce. In his video he was explaining how to make a conditions file with excel that would be used in his experiment. I wanted to make a very similar test where images would appear and subjects would be required to give a yes or no answer to them (the correct answer is already predefined). In his conditions file he had the columns 'word' 'colour' and 'corrANS'. I was wondering if instead of a 'word' column, I can have an 'image' column. In this column I would like to upload all my images to them in the same way I would words, and have them correlated to a correct answer of either 'yes' or 'no'. We tried doing this and uploaded images to the conditions file, but we haven't had any success in running the test successfully and were hoping somebody could help us.
Thank you in advance.
P.S. we are not familiar with python, or code in general, so we were hoping to get this running using the builder view.
EDIT: Here is the error message we are receiving when running the program
#### Running: C:\Users\mr00004\Desktop\New folder\1_lastrun.py
4.8397 ERROR Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path?
Traceback (most recent call last):
File "C:\Users\mr00004\Desktop\New folder\1_lastrun.py", line 174, in
image.setImage(images)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\image.py", line 271, in setImage
maskParams=self.maskParams, forcePOW2=False)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\basevisual.py", line 652, in createTexture
% (tex, os.path.abspath(tex))#ensure we quit
OSError: Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path? (tried: C:\Users\mr00004\Desktop\New folder\PPT Retention 1\ Slide102.JPG)
Yes, certainly, that is exactly how PsychoPy is designed to work. Simply place the image names in a column in your conditions file. You can then use the name of that column in the Builder Image component's "Image" field. The appropriate image file for a given trial will be selected.
It is difficult to help you further, though, as you haven't specified what went wrong. "we haven't had any success" doesn't give us much to go on.
Common problems:
(1) Make sure you use full filenames, including extensions (.jpg, .png, etc). These aren't always visible in Windows at least I think, but they are needed by Python.
(2) Have the images in the right place. If you just use a bare filename (e.g. image01.jpg), then PsychoPy will expect that the file is in the same directory as your Builder .psyexp file. If you want to tidy the images away, you could put them in a subfolder. If so, you need to specify a relative path along with the filename (e.g. images/image01.jpg).
(3) Avoid full paths (starting at the root level of your disk): they are prone to errors, and stop the experiment being portable to different locations or computers.
(4) Regardless of platform, use forward slashes (/) not backslashes (\) in your paths.
make a new folder in H drive and fill in the column of image in psychopy as e.g. 'H:\psych\cat.jpg' it works for me