MongoDB window closes automatically when I try to open - python

I'm trying to install MangoDB in my windows machine 64-bit. I'm following official documentation to install the same. I have installed successfully as stated and stuck at Run MongoDB section at step 2.
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
When I run the file "C:\Program Files\MongoDB\bin\mongod.exe" window opens and automatically closes. Not sure why this is happening, I Googled and tried troubleshooting the same but no luck. I even added MongoDB path to windows environment variables as well. But still it doesn't work.
Anyone faced this issue? Any suggestions would be helpful.
Thanks!

from doc:
MongoDB requires a data directory to store all data. MongoDB’s default
data directory path is \data\db. Create this folder using the
following commands from a Command Prompt:
md \data\db
You can specify an alternate path for data files using the
--dbpath option to mongod.exe, for example:
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
The reason of your problem is that you don't have that data directory.

Create a folder named 'data' with sub-folder 'db' in the root of the folder where your MongoDB Server is installed.
Like in my case, it was installed on C:/Program Files/MongoDB/ and the mongod.exe, mongo.exe resides in C:/Program Files/MongoDB/Server/4.0/bin/.
So, I created a folder namely "data" and a sub-folder in it namely "db".
C:/data/db
Sometimes, there might be a chance that "data" folder already exists in the root drive. Then, just create a sub-folder named "db" in it.
After all of this, close mongod.exe & mongo.exe if running. And open them again in order to see if the problem is gone! I hope that solves the problem.

As laike9m said, MongoDB requires the directory data/db to be created. I just solved the same problem and I did it by creating the directory in "C:/ " (working on windows).

Yep I ran into the same problem. go to the root of the drive that mongo is installed 'I had mongo installed on drive I:' so I clicked on drive I: and then I created a folder and called it data then I created another folder and called it db. note it has to be done right at the root so as soon as you click onto the drive if you try to put it in another folder on the drive Mongo will not be able to find it.

Related

How to package a Pycharm python project for upload to AWS Lambda?

Using pycharm on Windows.
I have created a zip file for upload to AWS Lambda the manual way:
1) Install the modules manually into a directory other than the default directory.
2) Create my .py code file
3) Zip the contents of the project folder
4) Upload that zip folder to Lambda
I am new to Pycharm and with a project I see that there are a whole bunch of files and folders that I do not understand.
I tried to zip the entire Pycharm project contents and upload - that did not work. It looks like I need to run some kind of setup that creates the proper folder structure and files that have the correct content.
Any help would be appreciated.
For all those still stuck with this, I have a few suggestions which could possibly resolve the issue altogether:
Use pip's -t option to specify the Application Directory
Using Pip's -t option, one can specify the Application directory. It's better than using the pycharm's package installer, as we can specify the installation directory with this.
Zip the complete Application directory (Answer's your question)
Go inside your Pycharm project directory -> select all -> Right Click -> send to compressed (zip). This may result in the inclusion of some unneeded directories (__pycache__, .idea), but would not affect the program execution. If needed, you may skip those two directories while creating the zip.
I believe you were zipping the project directory, rather than compressing the contents of the Project directory.
As I also answered here Jetbrains now offers the AWS Toolkit which allows local and remote development of Lambda functions.
Despite some lingering issues it works quite well. Still finding my way with it.
It includes packaging and deploying.
Toolkit page on Jetbrains website

Can't create a virtual environment in the Google Drive folder

I'm using Google Drive to keep a copy of my code projects in case my computer dies (I'm also using GitHub, but not on some private projects).
However, when I try to create a virtual environment using virtualenv, I get the following error:
PS C:\users\fchatter\google drive> virtualenv env
New python executable in C:\users\fchatter\google drive\env\Scripts\python.exe
ERROR: The executable "C:\users\fchatter\google drive\env\Scripts\python.exe" could not be run: [Error 5] Access is denied
Things I've tried:
I thought it was because the path to the venv included blank spaces, but the command works in other paths with blank spaces. I also tried installing the win32api library, as recommended in the virtualenv docs, but it didn't work.
running the PowerShell as an administrator.
Any ideas on how to solve this? My workaround at the moment is to create the venv outside of the Google Drive, which works but is inconvenient.
After running into the same issue and playing with it for several hours, it doesn't seem possible. It has nothing to do with spaces in file/folder names. I've tested that. It seems that Google Drive Stream perform some action to the file/folder after a period of time that makes python loose its path the files. For instance, you can take clone a python module into a Google Drive Stream folder, do a "pip install -e ./", and it will work in the virtevn for a few minutes, for instance importing it into a python shell. But after a few minutes you can no longer import the module. I suspect that Google Drive Stream is simply not fully compatible with all filesystem system calls, one of which is being used by python.
Don't set up a virtual env in a cloud synced folder, nor should you run a python script from such a folder. It's a bad idea. They are not meant for version control. Write access (modifying files) to the folder is limited because in your case Google drive will periodically sync the folder which will prevent exclusive write access to the folder almost always.
TLDR; One cant possibly modify files while they are being synced.
I suggest you stick to git for version control.

Why the parameter --auto-reload is not working if the addons path content are links to modules?

Description
Normally if you change your python code means, you need to restart the server in order to apply the new changes.
If the --auto-reload parameter is enabled means, you don't need to restart the server. It enables auto-reloading of python files and xml files without having to restart the server. It requires pyinotify. It is a Python module for monitoring filesystems changes.
Previous Problem
I got the error:
ERROR ? pyinotify: add_watch: cannot watch /home/user/.local/share/Odoo/addons/8.0 WD=-1, Errno=No space left on device (ENOSPC)
But I followed the advice of this link and now I don't get that error anymore:
sysctl -n -w fs.inotify.max_user_watches=16384
After this I got this in the server log:
openerp.service.server: Watching addons folder /opt/odoo_8/src/linked-addons
openerp.service.server: AutoReload watcher running
That means that's working properly. And in fact I tested it with a physical addon path and it worked.
Current Problem
I have all my modules en several folders but I only use one addons path: /opt/odoo_8/src/linked-addons. This folder contains all the links of the modules that I'm using. All modules are working well when I run Odoo.
But the problem is that pyinotify is not able to check the files beyond the links and it doesn't reload the files well. What I should do to fix this? Is there a way that pyinotify can recognise the content of the links?
PD: I don't want to change my way of managing the modules folders in Odoo.
The only solution I found is to isolate the custom modules in a different folder. I have added the new folder to the addons path in the configuration file and now everything works fine
addons_path = /opt/odoo_8/src/linked-addons,/opt/odoo_8/src/custom
PD: I saved the module folders directly in the custom folder instead of saving the links to the folders.

"Cannot start process, the working directory ... does not exist" error in PyCharm

When I run my Main.py script, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage does not exist.
This error occurred after creating a package (mypackage) for test purposes, moving files to it (including Main.py), and moving the files back to the root folder afterwards.
The package mypackage was empty after that, but PyCharm still thought that Main.py is located in that package. I could still run the program until I deleted the empty package, but path errors occurred. After deleting the package, I was unable to start it.
I can still run the other files that used to be in mypackage and are now in my root directory again.
I can still create and run new files in my root directory.
It happens because when you create a file it automatically assigns the working directory to it's configuration, which of course is the one where you created it.
You can change that by going into Run -> Edit Configurations. Click on the folder icon in Script path: and correct the path to the file. Click OK to save and you should be able to Run the file again.
After testing for a bit, I've found a solution (but not an answer to why this error occurs in PyCharm):
Delete the file and create it again. (Or rename or move it and create a new file with its old name, both should work.)
Set the working directory correctly
1. File-> Settings
2. Build, Execution, Deployment -> Console -> Python Console
3. Working directory: [The path to the directory where the file you're currently working on resides.]
I had the same problem, mine is probably related to the explaination gave by the others, it comes from the dir .idea, files *.xml contain the variable $DIR_PROJECT$.
Therefore, as the attribution of a new path didn't work, I just deleted my .idea, that is automatically loaded each time I open my project's directory.
It automatically regenerated the .idea, asked for the script path... And it worked perfectly
CAREFUL => You will automatically lose your project settings, you are deleting the "settings file"
I was getting this same error, and the path in "edit configurations" was correct.
However, this is what eventually got my code working again.
1) I commented out all of the code in my file ("ctrl" + "a" + "ctrl" + "/")
2) I commented something I knew would compile in the file. (my list of imports)
3) I ran the python file.
This time, it actually completely compiled and after that I was able to uncomment the rest of my code and everything worked again.
The issue kept popping up over and over in PyCharm. So I created a new project and loaded the needed script. Then I provided the directory to path and assigned the default Python version that I wanted to use... and it worked. Then I was able to finally use "execute line in console" once again.
I had this problem because I renamed my project, it was "xx" I renamed it to "yy", what I did was I went through the directory of .idea in the "yy", in any of those files (all XML files) if there were the name "xx", I replaced it with "yy"
I experienced this problem after moving my project to a different root directory. None of the above solutions worked for me.
I solved it by opening my entire project folder, instead of just the python file I was trying to run. And then running the file I wanted, while the entire project was loaded into PyCharm.
open the qtdesigner work dictionary setting and choose your project path then click OK, don't not use the mysterious work dictionary path by default
In my case Run -> Edit Configuration didn't help.
I've solved it changing the value of "WORKING_DIRECTORY" attribute in .idea -> workspace.xml
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/your/correct/path/here" />
I am a beginner so appreciated this 6 year and 6 month discussion. I couldn't add a comment. I setup PyCharm 2022.1.1 and a Python 3.10.4 virtual environment with pyside2 and pyside6 on Ubuntu 22.04. I tried all the suggestions above and could get none of them to work for me. Following these instructions: https://pythonpyqt.com/how-to-install-pyqt5-in-pycharm/ both pyside2-designer (Qt5Designer) and pyside6-designer from my virtual environment were added as external tools. pyside2-designer failed with the working directory error and pyside6-designer worked without any error. Looking closer at pyside2-designer selecting the working directory with the browse button, I still could not create file - exit code was 127 - but the Qt5 Designer was available for existing ui files. I used pyside2 because PyQt5-tools could not be pip installed in my python3.10.4 virtual env.
This worked for me on PyCharm 2021.3.2:

google app engine error ,and i can't open it now.(python)

the error is :
Errors occurred
See the logfile 'D:\Program Files\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe.log' for details
Why?
Find your home directory (open command prompt, run "set home" to see what it is). Go to that directory and delete the directory called "Google"
more here: http://code.google.com/p/googleappengine/issues/detail?id=2299
Solution:
Note: The wrong directories are stated above.
Go to C:\Users\your username\Google directory.
Delete google_appengine_launcher.ini and google_appengine_projects.ini
Appengine should now start successfully, absent error message.
yeah just like RyanW mentioned the link, Delete the .ini files viz. google_appengine_launcher.ini & google_appengine_projects.ini in the user Directory in folder named Google.
Had this error as well.
No log file.
C:/Users//Google/ was empty and no ini file there.
Ivan's solution didn't help.
I'm running a 64bit Win8 machine and this is what I had to do:
Remove my 64 bit python 2.7 install
Install 32 bit python 2.7 (direct link)
launch googleappengine installer and choose "Repair".
Voila.
Not enough points to provide a comment on the answers above hence the stand alone answer. If you delete the ini files as per the other answers the pathways to your projects in the launcher will likely also be gone. In my case however I simply moved the ini files out of the C:\Users\your username\Google directory and then after opening and closing the launcher successfully once I reinstated the ini files into the Google directory again, after which the launcher worked and the project pathways were retained.

Categories

Resources