Java SDK Update Tool "Python runtime could not be found" - python

I'm brand new to java, trying to dive into Java EE and I'm following the instructions here: http://docs.oracle.com/javaee/6/tutorial/doc/gexaj.html#gexaa to try to get everything setup. Unfortunately I'm not able to run the java update tool because I get the error:
Update Tool was unable to start.
The Python runtime could not be found.
To fix this problem use the UC_IMAGE_PATH environment variable to provide a path to a valid image.
To be clear, I've installed Netbeans at the Java EE 6 SDK and that's as much as I know. I have a background in PHP so this is a little different.
What piece am I missing?

check this solution:
http://www.java.net/forum/topic/glassfish/glassfish/update-tool-error
You can also start galssfish server (from NB or .bat file), log into administrator console (web browser: localhost:4848 if You haven't changed default ports) and then run update tool. Works for me, even though the first solution doesn't.
(I know, it's been a year of waiting for the answer, but someone might need this ;) )

Related

New to VSCode, Python - some env questions

I went through a few articles about how to setup VSCode to work with python for the first time, and I'm very confused.
To me, VSCode seems messy - so many json settings which I manually need to configure...
Anyway, I now have 3 ways of running my python script:
F5, which runs via the terminal
Run (Ctrl+Shift+D), via Watson
Run via Code Runner
I don't understand the differences between the different methods of running my script.
Can someone please give me a short intro?
Thanks!
Terminal:
Terminal is fast and efficient to use. It also provides detailed information about the errors in your programs. And it is widely used buy a lot of Python programmers.
Watson:
It provides developer tools for more advanced users. You can get more information about that from here. Not recommended for a beginner.
Code Runner:
Code runner is also used to see the the results of the programs but it is read only, and there can be some problems with that. As an example if you are building an application that takes the input from the user in Python, you can't do that via code runner.
So which one is the best?
I would recommend using the Terminal (F5), because it is good for small programs, you get detailed information about your apps, the problems with your apps and some other options too. It is also fast and easy to use for a beginner.
Hope it's clear now.

Getting "Premature end of script headers" on Dreamhost Python Webpage

I have a webpage made in Python Flask with Python 2.7 (I know), hosted on Dreamhost. Up until a few days ago I had absolutely no problems. Then, I started getting a permission error on my page. I don't know what happened, but I got with Dreamhost live chat and they solved it by doing a chmod 755 to my files. Everything was working again, but on further inspection, all the parts that generate a PDF document in my webpage have stopped working. The error that I am getting in the error logs is "Premature end of script headers".
This error only appears whenever I try to generate a PDF. The code works perfectly on my local environment, but it does not work on the hosting. I got with the people of Dreamhost again and they said that it was nothing on their side. Which is weird considering that the code that was ALREADY WORKING was not changed at all. I tried debugging on my part but I am not getting any errors.
I have tried pretty much everything I can think of to solve this situation but I have been unsuccessful. The course of action is to change this hosting (it was a mistake on my part to use Dreamhost in the first place, I know. But when I made this I was just starting and I had very little knowledge). But I need a quicker solution for the moment, and I was wondering if anyone has had this problem and could maybe help me out with this.
To elaborate, I am using Python 2.7, the library that is used for the PDF creation is Flask-Weasyprint (0.5). I tried running the wsgi file myself, and I am getting the following message:
/path/to/local/lib/python2.7/site-packages/WeasyPrint-0.39-py2.7.egg/weasyprint/text.py:29: UserWarning: There are known rendering problems with Cairo <= 1.14.0
warnings.warn('There are known rendering problems with Cairo <= 1.14.0')
/path/to/local/lib/python2.7/site-packages/WeasyPrint-0.39-py2.7.egg/weasyprint/fonts.py:46: UserWarning: #font-face support needs Pango >= 1.38
warnings.warn('#font-face support needs Pango >= 1.38')
I know that I should change to Python 3. When I made this web app, Dreamhost only accepted Python 2 and I barely had any knowledge of creating VPS or something like that. It is my plan to change hosting soon to a virtual machine and to run the project in Python 3. But I need a solution for this now before I go on.
Any help will be appreciated. If you need more details please let me know.
This may be due to the Passenger file not including your project directory in its path. One solution is adding the following to your passenger_wsgi.py file:
sys.path.append(os.getcwd()+"/<project_name>")

Unable to run pylinter, set python interpreter in VS Code

I've seen a few questions opened on Stack Overflow and the dedicated VS Code Git, but all of the solutions have revolved on reinstallations and after trying this on the Python extension and VS Code itself multiple times with necessary restarts I'm still nowhere nearer to a solution. Linter was performing fine up until a few days ago when it seems to have broken out of nowhere.
I've also noticed that "Go to Definition" isn't working (either the hotkey or menu navigation), so not sure if it's more a VS Code issue or issue with Python implementation, Intellisense seems to be working fine so leaning towards the latter.
Steps to Reproduce
1) Cntrl + Shift + P to open command pallette
2a) "Python: Select Interpreter" - error "spawn EPERM")
2b) "Python: Select Linter" - error "command 'python.setLinter' not found"
Versions
Python 3.6.6
Visual Studio Code 1.28
Python extension 2018.9.0
Windows 10
User Settings
Tried setting an explicit path per suggestion, but again no dice.
{
"python.pythonPath": "C:/Users/saun89/AppData/Local/Programs/Python/Python36/python.exe",
"python.linting.pylintPath": "C:/Users/saun89/AppData/Local/Programs/Python/Python36/lib/site-packages/pylint",
}
I'll probably go ahead and open a ticket on the actual github (although this seems less a product issue and more an issue particular to myself), but wanted to check with the stack community to see if anyone else has had to troubleshoot something similar. At least until this gets inevitably voted down to oblivion being similar to some other existing questions.
Extensive Error log (from developer tools)
Just in case they're helpful
notificationsAlerts.ts:40 Error: command 'python.setLinter' not found
at t._tryExecuteCommand (commandService.ts:57)
at commandService.ts:50
at n.Class.derive._oncancel.then (winjs.base.js:1587)
at t.executeCommand (commandService.ts:50)
at t.run (actions.ts:220)
at t.run (actions.ts:268)
at commandsHandler.ts:309
in case you happen upon this question I did discover an answer here. Looks like the SPAWN EPERM error was in fact related to my running as a user rather than as an administrator. When I run VS Code as Administrator able to work with the command palette fine. Hope this helps someone!
You might also get this error when trying to use the search bar called spawn EPERM and the cause might be an antivirus.
since Visual Studio Code creates new process for search and other features (SPAWN corresponds to a new process creation) this can cause the Antivirus to stop that process and causing this error and the feature to no work.
solution: Create an exception in you antivirus for VS Code or disable the antivirus all together (if you feel like catching a virus)
For setting the python interpreter question, temporary solution that worked for me on my Windows and Mac machines: use relative paths.
So in my case, instead of absolute path;
"python.pythonPath": "/Users/userid/p3env/bin/python" (on Mac)
"python.pythonPath": "C:/Users/userid/p3env/bin/python" (on Windows)
I used relative path from my working folder;
"python.pythonPath": "../../../../p3env/bin/python"
I haven't got any problem on my Ubuntu machine though. This issue affects many people I believe. It is also discussed in a few issues: [3326], [3326]. It seems that it goes away in some update and comes back again in another somehow. Above workaround solution is not a very convenient way to do it so I hope there will be a permanent fix for this.

Python3/MacOSX integration into pycharm

I have had trouble setting up the pycharm ide on my macosx10.7 with python3..
I have scoured every resource available and tried hundreds of approaches, at this point I must accept my incompetence and seek help via this channel.
In my research, I notice a lack of ground-up explanations on python integration into macosx and how to configure pycharm to import modules, run code within the editor, etc. If i ever solve this I will make a very detailed tutorial.
I have imported python3 successfully, it looks like it is linked appropriately from /sys/lib/frameworks to /usr/lib ...etc -- version control is working just fine.
I think my issue is either in setting environmental variables (tried the program to fix this and tried macports) and in the script needed to execute. it will catch errors throughout but final product does not run in python and returns printout of :
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /Users/anon/Desktop/pythonpractice/Py_Ex/classes.py
Process finished with exit code 0
i really need to get this configuration sound for my python programming class. please help (I've been through every line of pycharm website) .. preferably is there a way to map it via terminal? thanks for anyone who took the time to read this.
Summary of the discussion above:
Python 3.2.2 installation was broken on this Mac, installing ActiveState Python 3.2.2 from scratch and configuring it in PyCharm has fixed the problem.
Python path to be used in PyCharm settings: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3
Incompatible third-party plug-ins may break PyCharm, uninstall/disable them in Preferences | Plugins.
Ensure the latest PyCharm version is installed.
User's code depends on the graphics.py module which was not in the project or in the PYTHONPATH. Putting it into the project has solved the problem.
Most likely the wrong Run/Debug configuration was used in PyCharm, the easiest way to run or debug such scripts is by using the editor context menu Run and Debug actions. PyCharm creates the configuration automatically and debugging works fine as shown of the screenshot:
If one wants to configure and debug it, he can use the code.zip file to get started.
Sorry for the comments mess above, but it was not possible to move it into chat as user had only 1 reputation point, hence not able to use the chat feature of StackOverflow.

netbeans 7.1 and python

I used to use my Netbeans 6.9 for Python development. As well as Java and PHP. I had a cool debugger in PHP with xDebug, good Python support. Have no complaints whatsoever. I moved to another computer downloaded the latest netbeans(7.1) and now I have no more python plugin. I tried the solution here but this caused NetBeans not to start at all after the loading splash screen is finished NetBeans crashes.
Is there any way I can still code in Python with netbeans?
Thank you in advance
Ok, I fixed this. Say you've screwed up your netbeans installation by installing the pythonplugin then this might just work for you, provided you're using a non-windows OS. This is because Windows uses precompiled binaries to start the Netbeans IDE.
The problem that I solved is that, by default, a set of classes is not added to the Java classpath, which results in a crash. You can find whether this is also your problem by inspecting .netbeans//var/log/messages. If it displays some ClassNotFoundExceptions then we might have the same problem. If not, then at least you've got some pointers on what's going wrong and perhaps you might come up with some solution yourself. ;)
The java classpath is constructed in the file:
/<path>/<to>/<your>/<netbeans>/<installation>/platform/lib/nbexec
On OSX, this could be:
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/platform/lib
In the main loop the function construct_classpath is called, which in turn calls the function build_classpath for two directories. I changed the function to this:
build_cp() {
base="$1"
append_jars_to_cp "${base}/lib/patches" "patches"
append_jars_to_cp "${base}/lib" "lib"
append_jars_to_cp "${base}/lib/locale" "locale"
# Added by me:
append_jars_to_cp "${base}/modules/ext" "ext"
}
After that modification, start your IDE and everything should work fine. Good luck!
The Solution for this problem could be found here
http://sahanlm.blogspot.com/2012/12/netbeans-7-2-crash-on-start.html
I am currently using the developer plugins on Netbeans 7.0.1 with no problem. Maybe they simply aren't compatible with the new version yet. I'd suggest just getting a 7.0 and using that.
Add org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar at
C:\Program Files\NetBeans 7.1.1\platform\lib\locale. Start NetBeans, remove the plugin or the reference with problem, later on, delete org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar
Please see the following link. It works for me:
http://wiki.netbeans.org/PythonInstall
Currently your NetBeans/Python choices are:
Try the latest development build updates against your current NetBeans version and mess with breakage at times as noted on the PythonInstall NetBeans wiki page or the link you gave.
Install the latest development version, but realize it's not a stable public release.
Wait for someone in the community to step up with continued development to keep the existing plugin in step with the latest public NetBeans release.
Install the NetBeans 6.9 (or older) version you were using with no complaints just for Python work.
I have had success with older versions and the development build. I am dabbling with other Python aware IDEs while I wait for main stream support, but I've stopped holding my breath.
If you can't change nbexec, like suggested by Bas Jacobs (e.g. on Windows), or don't want to do that, you can use the --cp:p startup parameter to append the necessary JARs to the classpath.
I only had to add the org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar file, so the complete command line under windows now looks like this:
"C:\Program Files\NetBeans 7.1\bin\netbeans.exe" --cp:a C:\\Users\\_YOUR_USERNAME_\\.netbeans\7.1\modules\ext\org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar

Categories