hi develop code in python to scan wifi and send to the server, its working fine when execute manually, but i packaged it via http://www.python-packager.com by uploading my .py file and they create package for me as deb file for linux, and i download it and install the package but nothing happen when i click the .exe or set it as startup application,
why this happen, nothing is printed in the terminal
in .py file i'm having print statement to check manually to list out the wifi scan value, data to post to the server, response from the server once send
how this can be solve
thanks
I'm the maintainer of the project, I thought I'd chime in and give my 2c.
I had a look at your program. With .deb's, it installs everything to /opt/application-name. So to debug-it, run it from the command line. eg. "/opt/Jemapoh_Wifi/Jemapoh_Wifi".
I just ran it myself and your programs gives the error "IOError: [Errno 2] No such file or directory: '/opt/Jemapoh_Wifi/config.txt'". So your program's looking for config.txt but you didn't upload it with the program. :-)
If you have any further problems, please email me or report a bug on Launchpad - http://launchpad.net/python-packager. There'll be a re-vamped version coming out soon, hopefully it'll make things easier to understand.
Hope that helps/makes sense.
Cheers,
Jackson
"How this can be solved?"
Use a standard packager. Read this: http://docs.python.org/distutils/introduction.html and this: http://pypi.python.org/pypi/pip and this: http://pypi.python.org/pypi/zc.buildout
Related
So I can compile my project and run the .exe perfectly fine on my PC but if I try to share it with others or run it on another PC I get "Failed to execute script WS.py" I tried installing selenium, selenium-wire, python, and pyinstaller all in an env to fix this so the project would have everything it needed installed already.
Here is the error in CMD
Before this I was getting a pop up instead like this
The pop up
I am a nooby programmer so please explain like I'm five, thanks.
EDIT: I also have the exe in the spot where it is needed to run, I did not leave it in the dist folder. As stated it works on my PC but not on others when shared, I feel I am missing something simple here.
Alright just for context I'm an extreme newbie to python (around 15 minutes of experience).
My question is most likely a dumb one, but I'm gonna ask it anyways as I can't find anything about it elsewhere; Why can't I run the (very advanced) code below as a .py file? Using version 3.6 if it matters.
print("hello")
Thanks
Opening the python file will not cause it to execute.
Depending on your operating system (Windows, Mac, Linux) try opening a
command window and navigating to the file location of you python file.
Once you are in the directory (folder) of the python file that contains
the print statement run the following:
python myfile.py
Does that work?
Download and install
https://www.jetbrains.com/pycharm/download/#section=mac[Pycharm][1]
It is an IDE (Integrated Developer Environment). Pycharm will have what you need to write, save and execute python code all in the same application. There are others of course but Pycharm is as good as any to start with.
Good luck!
After upgrading macOS to Catalina, my Anaconda installation was helpfully reconfigured by Apple. Advice from the Anaconda website suggested a fresh install was the best way to go. Did that and all seemed good. I use spyder from the Anaconda navigator. But trying a previously running python code failed due to apparent file permission problems. For example,
file='/Users/stingay/Documents/Coaching/WAIS/2019:20/041019/Race Walk Test-2019-10-04T16.29.13.774-C5612E80FB1D-Accelerometer.csv'
with open(file,'rt') as f:
data = csv.reader(f)
next(data)
results in:
PermissionError: [Errno 1] Operation not permitted: '/Users/stingay/Documents/Coaching/WAIS/2019:20/041019/Race Walk Test-2019-10-04T16.29.13.774-C5612E80FB1D-Accelerometer.csv'
I can't see an issue with the permissions on the file or the directory structure in which the file sits. If I move the file to~/.spyder-py3 (the working directory), it works.
Looks like there is some extra python/spyder/anaconda permissions issue with the file/directory I can't spot. Any ideas?
I guess you have solved this by now, but for future reference, I still post my answer.
TLDR: I opened a file (from the folder causing the problem) directly in
the spyder editor (File | open). As a consequence, the editor should have triggered the pop-up dialog question whether you want to allow access or not. In my case, the mac silently granted python/spyder access to the folder. Now I can run the code in spyder without more problems than I have caused myself.
Longer version:
The source of your problem is described here:
https://www.howtogeek.com/443611/how-macos-catalinas-new-security-features-work/
Knowing that links are something frown upon, here's a summary:
The problem is that the folders "Documents" and "Downloads" folders nowadays are protected and you would need to go to the security & privacy settings and "Files and Folder,s" and allow the applications to access these. Unfortunately, spyder does not show up here. So, if you want to run your python program from the terminal, you should probably grant the terminal access to the folders.
Total noob here, but I might have stumbled upon a solution for people that have problems reading in their data in spyder after the Catalina update. I had the same problems you describe and got the same file permission errors.
I couldn't resolve the issue, reinstalled several times but didn't work for me. I couldn't use my Utorrent either, and while attempting to solve that problem I came across https://discuss.pixls.us/t/problems-with-darktable-and-mac-osx-catalina-solved-with-dt-2-6-3-1/14400/19 this forum.
Long story short, in the forum people couldn't really resolve the issue, but someone pointed out that if you just run the application from the terminal, it somehow works. I tried to do this with Spyder, and I seem to be able to use the read_csv('file') function again. So try opening the terminal, then type 'spyder' (without '') and press enter. Somehow all issues seem to be resolved. Hope this helps someone.
Same problem here. I re-installed Anaconda based on this link and Python is able to access folders where Catalina has added newly restricted security:
Install Anaconda following instructions below:
https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/
For Anaconda-Jupyter user, you are good to go
For Commandline (Terminal) Python user, you are good to go
For Anaconda-Spyder user, two options as a workaround after installation above:
Avoid Mac default setup-folders and relocate files to /Users/[user_name]/..
OR
Launch Spyder through Terminal (execute "sudo spyder") under root user
Lastly, changing or reseting folder/file permission does not resolve permission issue. Despite of the security issue under the more restricted security folders, somehow Spyder-Python is able to open .py files in these folders.
Since Jupyter and commandline Python can access these folders, I assume there will be a fix in the future for Anaconda-Spyder.
My code didn't work at all after Catalina update. The simplest partial solution that I found was to copy all files containing the scripts in a new folder. That works at least to run the codes, but I still dealing with annoying message to allow access to my files.
conda update --all in terminal worked for me. It updated everything. I did have to go through the annoying messages for access to my files as well. but after clicking yes a hundred times it was ab
I am trying to run a python script, .py in the windows command prompt.
I drag the script from my files into the command prompt window. I run it.
Then, the script presents a prompt for me to enter the file I would like to parse. I am supposed to enter a file like this: filename.txt
When I go to do this, I get the FileNotFoundError. They are both located in my downloads folder. Any ideas as to why? I've tried a couple of things but having no luck.
The script must be performed this way because this is a script many people will use and it is likely that they will receive it and download it and the file to parse to their computer so it'll be located in their downloads folder.
When I created the script I did it in Notepad++ and had a separate folder where I put the file and script and it worked fine this way. I am just ensuring it works from the perspective of someone who's downloading it off an email or website, etc.
Thanks !
Yeah that happened to me a lot.
To solve it just write the whole directory of the file.
If you are in windows
c:\user\username\Desktop\file.txt
If you are in linux or mac:
/home/username/Desktop/file.txt
I have Python program that I packaged with py2app so that the program query_agent.py became query_agent.app. I have a Java program that launches query_agent.app with the following command:
open ./query_agent.app --args abs_path1 abs_path2
, where abs_path1 and abs_path2 are string arguments.
I put everything in a folder and when I launch the JAR that eventually launches query_agent.app, everything runs perfectly as expected.
So I zip this folder so I can distribute it to others. Before sending, I put the zip on a flash drive and unzip it on another Mac computer to test it. Again, the program works as expected even when unzipped.
However, when I send the zip as a message attachment in an email, or upload the zip to a file hosting site like MediaFire, the program no longer works when unzipped. When I unzip the downloaded zip file on any Mac computer, right-click and open, I get the message:
query_agent Error
When I open the console, it shows the cause of the error:
The STATS_FILE_LOCATION points to a file that I am trying to write to. This file is located at query_agent.app/Contents/Resources/resources. As a reminder, this works fine if I use the version of the zip before it was uploaded.
It appears that the main error is shown in the last line as
OSError: [Errno 30] Read-only file system: 'resources/status.txt'
The first thing I notice is that it is finding my source files in the /private/var/folder/... location. I believe this a temp location, which may be why I am getting the "read-only file system" error. I never intended for anything to be read from or written to any location outside of my main applications folder.
I also get the message:
Detected missing constraints for <private>. It cannot be placed because there are not enough constraints to fully define the size and origin. Add the missing constraints, or set translatesAutoresizingMaskIntoConstraints=YES and constraints will be generated for you. If this view is laid out manually on macOS 10.12 and later, you may choose to not call [super layout] from your override. Set a breakpoint on DETECTED_MISSING_CONSTRAINTS to debug. This error will only be logged once.
So my question is: Why doesn't my program work if I upload it, download it, unzip it, and then try to run it?
It works before the upload on any Mac computer I put it on, so the fact that it gets zipped is not the issue. I hope that these obscure error messages can provide some hints to why this is happening. Any help with solving this problem will be greatly appreciated.