Pyinstaller is throwing an error message stating that it is unable to load AutoItX from the

When running my program from the command line, everything works perfectly fine. Now I need to create an Executable file, so I attempted to use pyinstaller. However, it seems that pyinstaller is unable to recognize the autoit module when automatically analyzing imported modules. Here is how I import the autoit module:

import autoit

I tried creating an executable using the following command:

pyinstaller --onefile ./rocketupload.py

This command resulted in an Error that flashed briefly on the screen and disappeared before I could copy it. I managed to generate a working exe by manually moving the autoit dll to the path indicated in the error message. However, this is not a viable long-term solution as I want the executable to run on other devices, not just my own.

I also attempted another method without success:

pyinstaller --hidden-import=autoit --onefile --paths c:\users\semjo\appdata\local\programs\python\python37\lib\site-packages\autoit\lib .\rocketupload.py

The issue lies in pyinstaller not including the autoit module in the executable, which prevents the program from running as expected. I am at a loss on how to resolve this problem after hours of unsuccessful attempts. Any help or guidance would be greatly appreciated.

Answer №1

I recently faced a similar issue and was able to resolve it by following these steps:

  1. First, I reinstalled the pyinstaller module using the most up-to-date installer found on Github: pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
  2. Next, I recreated the executable package by running this command: pyinstaller --hidden-import=selenium --hidden-import=autoit your [python_file.py]
  3. Then, I copied the installed autoit module folder from my PC's directory (C:\Users\\AppData\Local\Programs\Python\Python37\Lib\site-packages) and pasted it inside the [python_file] folder in the dist folder created by pyinstaller.

To verify that the solution worked, I ran the generated .exe file in the command prompt. Hopefully, this helps anyone facing a similar issue.

Answer №2

hiddenimports = [ "autoit.init", "autoit.autoit", "autoit.control",
"autoit.process", "autoit.win" ] 
datas = [
    [
        "C:\\Python27\\lib\\site-packages\\autoit\\lib\\AutoItX3_x64.dll", 
        "autoit\\lib"
    ]
]

Simply follow the instructions in the provided link to fix your issue. It worked for me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Prevent simultaneous access to the same element in the queue

Currently, I am in the process of reviewing and refactoring a queue system that is designed to be used concurrently by up to 20 individuals. However, at the moment, multiple users are able to access the first element simultaneously (We tested this by click ...

Django-Rest Framework: Implementing Cursor Pagination for Efficient Data Retrieval

Currently, I am in the process of developing an API using Django-Rest-Framework and I have implemented cursor pagination which is by default ordered by the 'created' filter. This setup has been working well for most of my views. However, I have ...

Switching the proxy server within Selenium automation

It appears that everything is functioning properly. fp = webdriver.FirefoxProfile() fp.set_preference("network.proxy.type", 1) fp.set_preference("network.proxy.http", PROXY_HOST) fp.set_preference("network.proxy.http_port", int(PROXY_PORT)) fp.update_pref ...

Identifying a class method being passed as an argument in Visual Studio Code - tips and tricks

In my code, I have noticed that vscode doesn't seem to recognize the last method bot.server.test_method(), even though it is implemented in the server class. The code runs fine, but vscode does not highlight bot.server.test_method() as an existing met ...

Ways to organically sort a string containing various numbers

Can someone help me with human sorting on the list below? I need to sort it based on the last numbers, for example, 45-50, 35-40, etc. list_list= ['N1-1TWS-AD03-____-001N-__45-50', 'N1-1TWS-AD01-____-001N-__50-54', 'N1-1 ...

The Pyspark 3.3.0 dataframe displays data without any issues, however, when attempting to save it as

Encountering a rather peculiar issue. The Dataframe displays data when running df.show(), but when attempting to write it as a CSV, the operation completes without any error messages, yet produces an empty file of 0 bytes. Could this be a bug? Is somethin ...

Cannot subclass `int` due to its unhashable type

Consider a scenario where we have a simple Test class that inherits from int: TEST_DICT = {1: 'a', 2: 'b'} class Test(int): def __str__(self): return TEST_DICT[self] def __repr__(self): return str(self) if ...

How can I ensure that the results retrieved from the Pocket API JSON are always in a single row? Let's find a solution

I have been attempting for hours and conducting a thorough search to extract a dataframe from the list retrieved from my Pocket API. However, my code is aggregating everything into a single row, which is not the desired outcome. I have made numerous atte ...

Enhancing the visual appeal of a 3D plot by incorporating a colormap into the add_collection function

Currently, I am in the process of constructing a 3-sided pyramid. I successfully created the sides using add_collection3d(Poly3DCollection). However, my goal is to incorporate a colormap dependent on the z-axis. I envision the top being red and gradually ...

Exploring the world of floating-point decimals in Python

In my python script, I declare a variable named dt and set its value to dt=0.30. Recently, I had to convert this script into a C++ program to achieve the same results. However, I noticed that the results start to differ at a certain point. This discrepancy ...

Creating xpath expressions in Python Selenium that can adapt to changing elements by using

I am attempting to find a visible element that will update based on user input on the website. I have been successful using a static XPath search string: wait.until(EC.visibility_of_element_located((By.XPATH,"//div[text()='Hierarchy']/following:: ...

Building a personalized payment experience using Python Flask and Stripe Checkout

I'm attempting to set up a customized checkout integration with Stripe on my Flask web application and I've encountered some issues. After copying the code from the Stripe documentation (located at https://stripe.com/docs/checkout#integration-cu ...

I need to remove the "./" prefix from all items in a Python list

Currently, I'm using Python to navigate through all subdirectories within a specific folder. In order to execute the OS commands, I require a list of all subfolders. However, the list is displaying with "./" preceding the folder names and I am aiming ...

Manipulating Data in BigQuery Using Python For Loops: Querying and Inserting Data Line by Line into a Table

I'm encountering an issue while attempting to execute a query (Google BigQuery) in a for loop and inserting data into a table with each iteration. Unfortunately, I only see the final row in the table, leading me to believe that the values are being ov ...

Is it possible to utilize a Python Selenium dictionary to create a more generalized xpath for a locator class

Is it feasible to consolidate multiple XPaths into a single 'general XPath' using a Python dictionary? In a locators class, I aim to identify all elements in a formula for automated data input (in the context of testing automation). For each fiel ...

Python class update for ttk.ProgressBar from another class

In my GUI, I have a main class where I create a ttk.ProgressBar: class MainApp(tk.Tk): def __init__(self): super().__init__() #--Main window self.title("MyApp") self.geometry('1000x500') self.noteboo ...

Transforming dimensions through tensor summation and weight adjustments

I am currently experimenting with building a custom layer in keras, but I've encountered an unusual issue. The problem arises when I try to sum the tensors before returning the result, causing a change in dimensions. This peculiar situation occurs spe ...

How can Python be used to track active programs?

My goal is to create a Python script that can run in the background for an extended period of time. The script will act as a productivity tool, automatically closing distracting applications while it is running. For example, if the user sets a timer for 30 ...

What causes confusion in Python when dealing with thread arguments?

I created a basic thread program: import threading Initializing threads class OpenThread (threading.Thread): def __init__(self, threadID): threading.Thread.__init__(self) self.threadID = threadID def run(self): prin ...

The JSON data has been identified as a string field rather than an integer

In my Python script, I have implemented a function to manipulate a series of JSON files within a specific directory. The goal is to extract the value stored in nt from the data and create a new key-value pair. When I display the values of nt, they are as f ...