I have a project which it's structure it's based on the pitftmenu.
I have created mine and by calling each py file separately everything looks to work smoothly.
If you notice on the pitftmenu there is a menu file which kind of links each py file (menu) together and you can switch to one another.
I have created mine according to my needs but when I call sudo ./menu on the console, the console says it does not exist.
It used to work but, I was experimenting with something else on my raspberry Pi, and I had to reinstall rasbian. I moved back my files and installed "all the packages" I needed. My only issue is that and I dont know why.
It is worth to be mentioned that if I run the menu file on the pitftmenu folder it is working. Any ideas?
As spectras said - It's not executable. If it should be, mark it as such with chmod a+x menu
Credits to spectras for the solution
Related
So I installed Miniconda using Homebrew and then installed Spyder using Conda. Then I wanted to make the process more "Mac" friendly by creating an application which opens Spyder so I used the solution by topoman which is below the accepted answer in this link:
Ways to invoke python and Spyder on OSX
Everything works more or less fine except I have ran into two issues (the second one isn't really an issue and more of an aesthetic related thing):
I downloaded py files from this GitHub (https://github.com/realpython/python-scripts) just to test that it will open py files. It works for them and I am also able to set Spyder as the default application by using the "SpyderOpener" solution provided by topoman in the above link.
The issue is that when I create a new file in spyder and save it then try to click-open it, it won't. I'm not sure what the difference is and why the "SpyderOpener" does not work on this py file originating from Spyder, but works fine for the ones I downloaded.
I was curious if it is possible to change the display icon for py files that have the default as "SpyderOpener". I did change the icon for the SpyderOpener application but it doesn't work. The icons for the files is just a blank printer sheet.
UPDATE:
I believe I found the issue. It depends on where the file is. When I put it on my desktop, no issue. When I put it in other certain places no issue. Based on experimenting it seems that the opener does not work when the file is within a folder that has a space in the name (e.g. folder name). The minute I change to folder_name or foldername it works fine.
Therefore, is someone able to explain why the opener script breaks down when there is a space at any place in the file path? Can the script be edited to handle this?
Does it boil down to the following stack threads (i.e. I need to apply double quotes somewhere in the script):
Shell Script and spaces in path
https://askubuntu.com/questions/1081512/how-to-pass-a-pathname-with-a-space-in-it-to-cd-inside-of-a-script
This thread also suggests the script shouldn’t use the $# argument unquoted because it will break as soon as you have “spaces or wildcards”:
https://unix.stackexchange.com/questions/41571/what-is-the-difference-between-and
Therefore looking at the script and previous steps you have:
#!/bin/bash
/usr/local/bin/spyder $#
Then the opener script has:
for f in "$#"
do
open /Applications/spyder.app --args $f
done
if [ -z "$f" ]; then
open /Applications/spyder.app --args ~
fi
As for the rest of the script, I assume $f isn’t going to cause problems? Anyways, it seems the issue comes from the initial setup?
Based on this, it should be handled by the above line:
Handle whitespaces in arguments to a bash script
So is it breaking down because of the args?
I am doing an application in Excel and I'd like to use python language. I've seen a pretty cool library called xlwings, but to run it a user need to have python installed.
Is there any possibility to prepare this kind of application that will be launch from a PC without Python?
Any suggestion are welcome!
A small workaround could be to package your application with cx_freeze or pyinstaller. Then it can run on a machine without installing python. The downside is of course that the program tend to be a bit bulky in size.
no. you must need install a python and for interpreting the python function etc.
It is possible using xlloop. This is a customized client-server approach, where the client is an excel .xll which must be installed on client's machine.
The server can be written in many languages, including python, and of course it must be launched on a server that has python installed. Currently the .xll is available only for 32 bits.
This might not be exactly what you're looking for (i.e.- "without python"), but you could ship it as a virtualenv .zip folder with all the necessary packages and respective python installation included in the folder... and also include a run.command bash executable inside the folder that the user can click on to run your program. You'll have to tell the user (inside a README.txt or something) how to enable the executable... For a particular application mine looked like...
Please complete the following steps after installation of MyApplication.zip:
Step 1: Move the MyApplication folder to your Desktop.
Step 2: Open your Terminal in Go then Applications then Utilities.
Step 3: In the Terminal, paste cd ~/Desktop/MyApplication
then press Enter.
Step 4: Then, paste chmod +x run.command
then press Enter.
From now on, clicking the “run” file in MyApplication will run the application.
If clicking the “run” file still doesn’t work, then do…
Click Ok on the popup then Open System Preferences then Security & Privacy
then Click on Open Anyway button then Click Open button on the popup.
NOTE: Please do not move or delete the MyApplication folder, or any of its files.
Then my run.command executable looked like the following:
cd ~/Desktop/MyApplication
PATH=$PATH:$HOME/Desktop/MyApplication/lib/python2.7/site-packages:$HOME/Desktop/MyApplication/lib/python2.7/site-packages/aeosa:$HOME/Desktop/MyApplication/lib/python2.7/lib-dynload:$HOME/Desktop/MyApplication/lib/python2.7/lib-old:$HOME/Desktop/MyApplication/lib/python2.7/lib-tk:$HOME/Desktop/MyApplication/Extras/lib/python:$HOME/Desktop/MyApplication/lib/python2.7/plat-mac/lib-scriptpackages:$HOME/Desktop/MyApplication/lib/python2.7/plat-mac:$HOME/Desktop/MyApplication/lib/python2.7/plat-darwin:$HOME/Desktop/MyApplication/lib/python2.7:$HOME/Desktop/MyApplication/lib/python27.zip
source bin/activate
python main.py
Three things are important here:
1) In run.command, I first change directory into the virtualenv I created for this project. I'm not trying to be dynamic here, since this is all just a quick hack of a solution, so as part of the README.txt, I simply tell the user to put the folder they downloaded onto their desktop. Otherwise, the cd command wouldn't work.
2) I set the client's PATH variable, separating entries with colons. You can see a list of the paths you'd need using a quick check on your computer...
import sys
for path in sys.path:
print path
3) I then call source bin/activate to activate the virtualenv.
4) I then execute my main.py file, which is in the top level of my virtualenv, along with run.command.
5) I only wrote this bash file for Mac OS X, so I don't know how it would translate to windows PCs. I think the only thing that'd change is that the path literals would need to use backslashes instead of forward slashes, but again, I haven't done this for windows so I'm uncertain.
Read more about setting up a virtualenv here: https://virtualenv.readthedocs.org/en/latest/index.html
Finally, note that you will not be able to send your final, working .zip folder over most email services, since they tend to prevent people from sending executables back and forth, so you'll have to use a service like Dropbox or something to send it to people.
With Fileconveyor limited documentation I'm confused as to where it installs after I've run the pip command as follows on their website Fileconveyor.org.
Bottom line: Anyone have luck installing Fileconveyor on Debian 6 for integration with Drupal 6 and the CND Module?
I can't figure out where to put my settings.xml file.
Thanks,
Curtis
The documentation does give indication of where things are put, but it isn't entirely clear in that we expect an "installation" to move things to certain destinations, such as /usr/bin. In reality, Fileconveyor is installed in the very same directory as wherever the git clone placed it.
The settings file (which must be cp from a file named "config.sample.xml") is in a folder 'conveyor' within the main 'conveyor' folder.
The link where you can read about this is https://github.com/wimleers/fileconveyor
It reads in part: "The sample configuration file (config.sample.xml) should be self explanatory. Copy this file to config.xml, which is the file File Conveyor will look for,
and edit it to suit your needs."
Starting it doesn't actually invoke any command with the name 'fileconveyor', which I previously mentioned is what one might expect from a typical installation. Another instruction from the above link reads:
"Starting File Conveyor
File Conveyor must be started by starting its arbitrator (which links
everything together; it controls the file system monitor, the processor
chains, the transporters and so on). You can start the arbitrator like this:
python /path/to/fileconveyor/arbitrator.py"
In my case the command is 'python ~/src/conveyor/conveyor/arbitrator.py'
In retrospect I might reinstall in another directory in case I ever empty my ~/src folder which is the folder I use to initially download items to compile and install, then clean. I wasn't expecting it to end up being the installation folder for Fileconveyor.
Hope this helps.
I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it cannot see the edited PYTHONPATH environment variable. It used to work just fine (everything would run in the same windows console). I just installed Vista SP2 and this problem showed up. Any thoughts on how to fix what might be broken?
Thanks.
Have you tried changing the extension of the python script to .pyw, or just invoke it with pythonw.exe?
It could be that the .py filetype is associated to pythonw.exe, therefore causing it to open in a new process. Find any .py file, right click it, select properties, and check to see under "Opens with:" what the default interpreter is.
Ok, so I decided to reinstall python. If I uninstall and reinstall (I was using the windows installer) in the default location, it seems to have no effect. I cleaned out the registry and reinstalled. Still no different. However, if I install python in a different location (other than the default) it seems to run fine. Something is obviously corrupt somewhere, but I don't know where. So I am going to just reinstall all of my other modules in a different location and go from there.
Thank you all for your responses.
I have purchased PyCharm and am trying to get things to work however I am encountering this issue..
Once I start a project everything works great...
Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this directory to the python path.. I am trying to do so by creating a file sitecustomize.py at lib/python/2.6/site-packages/
However once I create an app and try to import it I keep getting non excistance errors (yes I have reloaded the python interpreter in pycharm)
I reckon I am adding my locations to the python path in the wrong way.. Also I might not have my project location setup correctly (currently /users/me/djangoProjects)
Thanks,
Novice django'r
In pycharm open the settings "cmd" + "," and then to "Project Structure" click on "Sources" to include any modules.
Don't add that file to your python site-packages, then your django project is gonna be included for all future projects down the road.
If you wanna debug, within PyCharm, click the Run tab up top and choose Edit configurations. Choose the project you are working with and make sure you add the directory where your manage.py and settings.pr file are to the "Working Directory". So I assume it might look something like this:
Working Directory: /users/me/djangoProjects/{Project Name}
If there is something else that you need to add to the Python Path, you can add it it by going to File-Settings-Python Interpreter and then add a new path in the bottom window (but once again this will be used by any project you run in PyCharm
But if you are not debugging in PyCharm and just wanna run the app, I find it easier to run it from the command line. I assume you are on Mac by your path, open the Terminal and go to the directory where your project is (same directory as the manage.py file) and type:
python manange.py runserver
If you want to give it a specific port add it to the end
python mange.py runserver 9000
This way you can edit your code in PyCharm and it will get reinterpreted when you save the file. If you are debugging in PyCharm, you need to stop the debugger and run it again to pull in your changes