unable to install PunJab - python

I am unable to install PunJab on my system.
PunJab is a HTTP jabber client
interface. It is a BOSH connection
manager that allows persistent client
connections to a XMPP server.
When I type the following command
python setup.py install
It says invalid syntax error.. I have python 2.7 and twisted python 10.2 running on windows XP.I have set the environment variables for python...
What have I done wrong ?
Thanks

wat the heck is punjab?? I have no clue what it is.. But anyways when you add it to your system path it doesnt become part of your system path immediately.. A restart is normally required.
Instead what I would suggest is go to your python install directory and find the executable or python script that is needed to run this program and go to the command prompt and run it with your file name.
Going to Cmd prompt: Start -> Run -> type cmd and Enter
A black box should appear and now type the executable full path that you need to use like
C:\Python27\python.exe "location of your file"
thus your command should look like
C:\Python27\python.exe C:\users\kavya\Desktop\Punjab.py
Well hope that helps and please let me know wat the heck is Punjab and I know u r nt talking abt the state..

Related

Cmd prompt executes code without py prepended but ignores command line arguments (Automate the Boring Stuff)

Running Python 3.9 in Windows 10. Python installed via Windows 10 Store.
PATH environment has directory with file being executed.
I'm running the following code from Chapter 12 of Automate the Boring Stuff, a google map launcher:
#! python3
# mapIt.py - Launches a map in the browser using an address from the
# command line or clipboard.
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
# Get address from command line.
address = ' '.join(sys.argv[1:])
else:
# Get address from clipboard.
address = pyperclip.paste()
webbrowser.open('https://www.google.com/maps/place/' + address)
When I open CMD and type:
mapIt.py Empire State Building
The program will execute except ignore the Empire State Building arguments from CMD and use whatever is on my clipboard instead when launching google maps on the browser. Prepending py here gives me [Errno 2] No such file or directory
Through troubleshooting I have found that when I navigate to the folder in CMD and try the code it still ignores the command line arguments, however, when I navigate to this folder and prepend py the code will work as intended. So this:
C:\(file_directory)>py mapIt.py Empire State Building
will launch google maps with Empire State Building in the search.
Can anyone illuminate what is going on here? I do have Mu installed and was wondering if that version of Python included in that installation is messing with which python is being called in command prompt.
I found the problem.
Something went wrong with my file associations when installing multiple versions of Python.
To fix the problem, I went to my python script, right clicked it, selected "Always open using this app.", and navigated to C:\Windows\py.exe.
Now when I open CMD and only type mapIt Empire State Building, the program launches my browser to google maps with a search for Empire State Building.
I suspect this is a registry issue but as far as I am concerned it is now working.

How do I run a downloaded repository's config in Python?

I am trying to use sunnyportal-py. Relatively new to python, I do not understand step 2 in the README:
How to run
Clone or download the repository.
Enter the directory and run:
PYTHONPATH=. ./bin/sunnyportal2pvoutput --dry-run sunnyportal.config
Enter the requested information and verify that the script is able to connect to Sunny Portal.
The information is saved in sunnyportal.config and can be edited/deleted if you misstype anything.
Once it works, replace --dry-run with e.g. --output to upload the last seven days output data to pvoutput or --status to upload data for the current day.
Add --quiet to silence the output.
Could anyone help me? I have gone into a cmd.exe in the folder I have downloaded, I don't know how to correctly write the python path in the correct location. What should I paste into the command line? Thanks!
Edit : I would like to be able to do this on Windows, do tell me if this is possible.
The command at bullet 2 is to be typed at the commandline (You need to be in windows: cmd or powershell, Linux: bash, etc.. to be able to do this).
PYTHONPATH=. ./bin/sunnyportal2pvoutput --dry-run sunnyportal.config
The first part of the command code above indicates where your program is located. Go to the specific folder via commandline (windows: cd:... ; where .. is your foldername) and type the command.
The second part is the command to be executed. Its behind the "--" dashes. The program knows what to do. In this case:
--dry-run sunnyportal.config
running a validation/config file to see if the program code itself works; as indicated by "dry run".
In your case type at the location (while in cmd):
"sunnyportal2pvoutput --dry-run sunnyportal.config"
or
"sunnyportal2pvoutput.py --dry-run sunnyportal.config" (without the environment variables (python path) set).
Note: the pythonpath is an environment variable. This can be added via: Control Panel\All Control Panel Items\System\ --> bullet Advanced System Settings --> button "environment variables". Then you can select to add it to "Variables for user "username"" or "system variables". Remember to reboot thereafter to make the change effective immediately.
Update 1 (pip install sunnyportal):
go to cmd.
type "pip search sunnyportal"
Result:
Microsoft Windows [Version 10.0.18363.836] (c) 2019 Microsoft
Corporation. All rights reserved.
C:\Windows\System32>pip search
sunnyportal
sunnyportal-py (0.0.4) - A Python client for SMA sunny portal
C:\Windows\System32>
If found, then type:
"pip install sunnyportal"

I always fails when compiling WebKit , OS : Windows10 1809 x64

1).Before compiling WebKit, I reinstalled Windows 10. The terminal I used when
compiling it was PowerShell.
2).The guide I use is here: https://webkit.org/webkit-on-windows/,I did not
install cygwin.
In addition, I set up two environment variables in accordance with another
guide: WEBKIT_LIBRARIES & WEBKIT_OUTPUTDIR. This guide is here:
https://webkit.org/building-webkit-on-windows
3).The main problem is that when I run "perl build-webkit" in powershell,
it will report an error:
"Free to wrong pool 1b8e80 not 9504a10099d76a14 at
C:/Perl64/lib/IO/Socket/SSL.pm line 2739.
Can't spawn "perl Tools/Scripts/update-webkit-support-libs": No such file
or directory at build-webkit line 257.
Died at build-webkit line 257."
and every time I run this command, I will receive almost the same error, for
example, I just ran it again.Then the error is as follows:
"Free to wrong pool e38e80 not 95054c000387c36b at
C:/Perl64/lib/IO/Socket/SSL.pm line 2739.
Can't spawn "perl Tools/Scripts/update-webkit-support-libs": No such
file or directory at build-webkit line 257.
Died at build-webkit line 257."
4). I tried to solve my problem through Google search, but I didn't find any
useful content, so give me some help please, thanks.
You can start powershell as user or as administrator. I'll suggest, you retry executing as administrator. If you are a regular user or logged on as admin, it's not the same than the right mousebutton to find the right way.
Be sure, that you have all scripts. Maybe, that your archive is buggy.
Sometimes its useful, to place the dll into the system32 directory. I think, that in your case, the mistake is in assiciation. You have both on Win10x64, the x86 and x64 dll's.
I'll suggest, that you try to build on a win7 x86 win32 first. Second step should a contact to the mozilla webkit team.
My experience of Cygwin was a very short one. It's like a toy without battery.
The problem has been solved by running the command "perl build-webkit -- skip-library-update" in PowerShell.
It's better to download and extract WebKitAuxiliaryLibrary.zip and WebKitSupportLibrary.zip to the right location first, and then build-webkit.

How to setup Atom's script to run Python 3.x scripts? May the combination with Windows 7 Pro x64 be the issue?

I'm trying to switch from Notepad++ to Atom, but I just can't manage to get my scripts executed in Atom.
I followed this answer (so I already installed script) which is not really extensive and also the rest on the web doesn't offer anything comprehensible for beginners.
In Notepad++ NPPexec I used to
NPP_SAVE
cd "$(FULL_CURRENT_PATH)"
C:\Python34\python.exe -u "$(FULL_CURRENT_PATH)"
and in Sublime Text 2 I made it run by creating a new "Build System":
{
"cmd": ["C:\\python34\\python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
Can you please guide me how to setup Atom to be able to execute Python scripts with Python 3.4 scripts with a keyboard short-cut?
I already tried to set my init-script to:
process.env.path = ["C:\Python34\python.exe",process.env.PATH].join(";")
respectively
process.env.path = ["C:\Python34",process.env.PATH].join(";")
with no success.
When I go to Packages -> Script -> Configure Script and type
C:\\Python34\\python.exe
it works. But thats not a permanent solution.
When I press Ctrl+Shift+B to run a script, without configuring it before (as it is supposed to work), I get (suggestion of ig0774's comment implemented):
(it doesn't matter whether it is C:\Python34 or C:\Python34\)
It complains that python is not in my path - but it is.
I read multiple times that Windows 7/8 64bit together with Python 3.x could cause issues with certain packages. May this be the reason in ths case as well? I have Windows 7 Pro x64.
Update
As I've switched to VSCode and probably stay there, I'm not willing/don't have the time to try out all the answers, so I let the community judge the answers and accept always the highest voted. Please ping me, if it's not correct anymore.
This can be easily solved by editing the /home/.atom/packages/script/lib/grammars.coffee file (note that the atom folder is hidden so you might have to press ctrl+H to view hidden files and folders)
Inside grammars.coffee find:
Python:
"Selection Based":
command: "python"
args: (context) -> ['-u', '-c', context.getCode()]
"File Based":
command: "python"
args: (context) -> ['-u', context.filepath]
and replace with:
Python:
"Selection Based":
command: "python3"
args: (context) -> ['-u', '-c', context.getCode()]
"File Based":
command: "python3"
args: (context) -> ['-u', context.filepath]
Save changes, restart Atom and enjoy running your scripts with python 3
EDIT: On Windows I believe the grammars.coffee file is located in
C:/Users/Your_Username/AppData/Local/atom/packages
Again, the AppData folder is hidden so you might have to change your settings to view hidden files and folders.
To expand on #matt-nona answer. You can go to his mentioned config file right from Atom. Simply go to settings then "Open Config Folder":
Then /packages/script/lib/grammars.coffee Find "Python" and make the appropriate change to python3:
Following up on Matt Nona's advice , when Atom starts-> Welcome Guide (or control+shift+T)-> 5th one down 'Hack on the Init Script'. A blank page will open and you can add that modifications in there.
Update: for any other souls looking for this answer - On my Mac I do not have a grammars.coffee file within atom script config file.
Instead, there s a grammars folder, and I have a python.coffee file in there. The same changes outlines in the screenshot (ie add '3' to the end of the two mentions of python) fixed my issue and atom automatically runs Python3 now.
Not sure if the above answers are Windows specific or if there have been dev changes since 2017.
same problem just like you. 'Packages -> Script -> Configure Script' is not permanent. So I has tryed another script runner:https://atom.io/packages/atom-runner, just found the problem is in the python script itself.
When I use atom-runner, I got error message like this:
atom-runner error
So it remind me that in the beginning of the python script: ' #!/usr/bin/env python3 '
It's obvious that the ENV_PATH is WRONG here. I should revise it in my python script.
Setting the PATH within Atom did not work, setting it with the cmd, via
set PATH=%PATH%;C:\Python34
neither, and setting it in the Windows 7 system properties failed as well.
However reinstalling Python 3.4 and check Add python.exe to Path
seems to be neccesary. Also I needed to uninstall Atom completely (inculding all packages or a least script) and reinstall it from scratch.
After all these steps:
Install Python with Add to Path
Install Atom
Install script package
it works out of the box (Ctrl+Shift+B) and no further steps are required.
I still don't know what was the reason before and I don't know which of this steps are really required. So feel free to include your procedure without reinstalling everything.
Update
Reinstalling everything is certainly not necessary, simply updating/repairing the installation with the installer is sufficient.
Use the script-runner https://atom.io/packages/script-runner/
"N.B. these keyboard shortcuts are currently being reviewed, input is welcome.
Command Mac OS X Linux/Windows
Run: Script ctrl-x alt-x
Run: Terminate ctrl-c alt-c"
And "Run Terminate" (Alt + c) to use the current python in your system.
edit your python.coffee script
$ sudo nano .atom/packages/script/lib/grammars/python.coffee
For Linux and Mac, adding environment in the script will pick correct python version. (command + I to run)
for running with python3
#!/usr/bin/env python3

Installing Pypotrace for python

On a thread supposedly detailing how to install Pypotrace on Windows (Installing Pypotrace for python?), someone was told:
"You need to install mingw and make sure it is working in msys mode - run msysand you should get a command prompt in it type gcc --version and make sure you get a sensible reply. also make sure your Python runs from within msys."
In response to the comment that
"You should get a command prompt in it type gcc --version and make sure you get a sensible reply"
I noted that I don't- I get "command not found." What should I do to
resolve this issue?
"Also make sure your Python runs from within msys."
How can I check this?
In response to the question
"Do you have ez_install.py?"
I do. But "Is it on your path?" only leaves me wondering: Which path?
Is it possible to explain any of this clearly, without skipping important issues like what programs are being used, or what to do when something isn't working, and what paths are meant?
Please modify your system path with gcc and easy_install paths as below:
import os
os.environ["PATH"] += os.pathsep + path_to_your_executable_file
where path_to_your_executable_files should be a string like "C:\\Program Files\\Python27".
Also (for Windows OS) you can do the same step-by-step with this instructions: http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path

Categories