Excel can't establish with xlwings connection when running from standalone Python app from Excel - excel

I am trying to create standalone app from a script with xlwings. I used both py2exe and cx_freeze. Both work just fine outside Excel (I added some tests). When I import either of them as a VBA macros in Excel, they also work fine. But so far, on my computer only. I asked my friend to check if the script works on her computer and she got the following error:
So I thought it make sense to figure out whether I do something wrong. I sent her a Fibonacci example and it raised sort of the same error:
It should be something wrong with names of the files, but it's not like obvious for me what exactly. Maybe somebody already knows how to deal with it? Thanks!

If files are downloaded from the internet, they only work right away in the first instance of Excel. Meaning: Your friend should try to close Excel completely. Also check in the Task Manager if there is still an EXCEL process running and if so, kill it. Then try again in a fresh instance of Excel.
update:
Ah I see - the problem seems to be a bug happening when there are unicode characters involved in the file path! I've opened a issue here. In the meantime, try to run the file on a path without unicode characters.

Related

Is it possible to run a python script when another computer connects to the website?

Im trying to set up a prank for my coder friends(have to clarify its not something bad, its just a harmless joke) and they are much more experienced than me. They like to brag about it, so I wanted to make them look like they got hacked by getting a singular file from their computer. Is it possible to run a script to take a their file from their computer as soon as they click on a link that i can share on discord?
I got python script to get a file, but its only when you download the script and use it, it also requires you to have any python version 3+ to run the code. Tried to make a short link but couldnt get it work either.

.exe doesn't work after converting from .py with auto-py-to-exe

everyone!
I'm new in programing.
I faced the problem that my .exe doesn't work after I converted it from .py file.
File is prety simple. It's load data from excel to scv using pandas and time just for the logs.
I haven't caught any errors during the convrting proccess, but when I open .exe, it shows only terminal with flickering cursor.
I also add "--exclude-module" for other instaled modules which wasn't used in my program. It helped decrise size of the end .exe file, but still it doesn't work.
If you have any ideas, please share with me.
I found the solution in this answer https://stackoverflow.com/a/71626038/17618130 Basicly it offers to use raw Pyinstaller without auto-py-to-exe But i'v found that it is still working only on windows server, but don't work on Windows 10. So I still need help(

Excel VBA macro failing to save workbook on coworker's computer, but fine on mine

I'm encountering an issue trying to get some macros and VBA scripts working on a new coworker's computer. I've been using the same code for years on my machine and several others without issue, but when my new analyst tries to run it, it throws an error stating it couldn't save the file. He can manually save the file without issue, but running the script throws the error. The really weird part is that it lists the file path, but replaces the filename with a seemingly random hex byte.
On another file, if he opens it, closes with or without saving, then I open the file and try to save it using a macro, it fails saying "cannot access file...". If I copy and paste the file, open and run the macro again, it saves over the offending file no problem.
We've checked permissions and settings and haven't found anything that was different between the two systems. We're both on VMs. His hardware allowance is less than mine but otherwise they're both IT-managed and identical. I'm at my wits' end... Any advice on what may be the source of my grief would be helpful, even if not a solution.
A couple of things I'd check before trying to step through debugger mode.
Coworker does not have write access to the directory (I think you said you checked already)
The new users' Trust Center Settings are not correct
File > Options > Trust Center > Trust Center Settings... > Macro Settings > Ensure the box is checked to trust the VBA model and that macros are not disabled
The new user does not have the same libraries referenced.
Alt + F11 > Tools > References... > Check if coworkers' libs match yours
Is he using a new/different version of Excel that you? A lot of older code got bojangled when Office 365 hit the scene.
After checking settings, I would ask the following:
What error is thrown when coworker attempts to run the macro?
When does the error get thrown? It could be that you have code that is attempting to edit the file (or has another file stuck in an edit) at the same time you're trying to save it.
I would see why the file name is getting corrupted. It sounds like coworkers' machine is looking to a bit of memory or memory address that is somehow getting forgotten. Like the code is referencing a variable that is out of scope.
User Access Control has been enabled on his VM that is somehow preventing him from saving the file correctly.
Your code does not properly Quit the Excel application, so its still running in the background on coworkers' machine. Have them open/close without saving a file and check Task Manager to see if Excel is still up to confirm

Is There a way to recover a severely corrupted EXCEL FILE?

I'm currently working on my data using Ms.Excel.
But suddenly the file that I'm working in was broken. when I tried to open it again I get error where it contain "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" (See Picture).
Screenshoot Corrupted Excel File
The data was not really big, it's only arround 130KB. Besides, Autorecovery Mode was Turned On every 10 minutes. But I don't know How To use it.
I tried to solve the problem many times using below method:
First, I tried to check the "Ignore .... " in Excel Option.
Second, I tried Open and Repair the file, but still can't open it.
Third, I tried to use a third party, Using 2 Software (Stellar Phoenix Excel Repair And Recovery Tools For Excel). but Both not Working.
So I wonder if anyone can help me to get my data back? is there any way to recover the file? or is there a way to get the data within the file?
Thank you for all the suggestion you gave me, From the last comment I tried to get and extract the data using Programmer editor and using VBA, but both not give a good result, basically when you tried to extract the data when the file is corrupted it only get a unique character.
So here is my solution, since i'm using windows, I tried to Reinstall my Ms.Office and recover my Excel file on mac, and boom the magic worked.
Once again, thanks for your help.

Matlab UI program works unproperly after deploytool

this is the first time I'm encountering this kind of issue.
I have a perfectly working code that runs without any issue under 3 different platforms (Win/Linux/OS X).
However after the deploytool compilation a part of it stops working. How can I get the error once the code is compiled!? It seems that it has some problems in loading and reading .mat files. Is that possible?
I hope someone can help me.
Thanks
edit:
I've solved the problem! Unfortunately was all addpath fault!
I have a lot of folders with files and functions that are needed for running the code, after the compilation matlab does a mess with all of that folders.
Good hint: do not use addpath for the compilation! Thank you anyway!
You can try to catch the error and write it to a text file. Or build in a check that prints text to the screen.
A bit more in general: You can try to isolate the part of the code that has the problem, and then basically cut out half of the functionality in this part repeatedly until you have exactly found the source of the error.

Resources