Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: source code string cannot contain null bytes when starting broker #63

Open
reedwhaley opened this issue Oct 24, 2024 · 6 comments

Comments

@reedwhaley
Copy link

reedwhaley commented Oct 24, 2024

I'm sure I'm missing something super simple and I apologize in advance. I'm starting broker with the command "uv run ffxiahbot broker --inp-csv items.csv --buy-items --sell-items" and it returns SyntaxError: source code string cannot contain null bytes and doesn't start. "uv run ffxiahbot --help" runs correctly. Here is the entire output when running the broker. Thank you in advance for the assistance!

PS C:\ffxiahbot\bin> uv run ffxiahbot broker --inp-csv items.csv --buy-items --sell-items
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\ffxiahbot\ffxiahbot\apps\broker.py:37 in main                                                                     │
│                                                                                                                      │
│    34 │   """                                                                                                        │
│    35 │   Run a bot that buys and sells items on the auction house continuously.                                     │
│    36 │   """                                                                                                        │
│ ❱  37 │   from ffxiahbot.auction.manager import Manager                                                              │
│    38 │   from ffxiahbot.itemlist import ItemList                                                                    │
│    39 │                                                                                                              │
│    40 │   if inp_csvs is None:                                                                                       │
│                                                                                                                      │
│ ╭───────────────────── locals ─────────────────────╮                                                                 │
│ │     buy_immediately = False                      │                                                                 │
│ │           buy_items = True                       │                                                                 │
│ │            cfg_path = WindowsPath('config.yaml') │                                                                 │
│ │            inp_csvs = [WindowsPath('items.csv')] │                                                                 │
│ │ restock_immediately = False                      │                                                                 │
│ │          sell_items = True                       │                                                                 │
│ │       use_sqlite_db = None                       │                                                                 │
│ ╰──────────────────────────────────────────────────╯                                                                 │
│                                                                                                                      │
│ C:\ffxiahbot\ffxiahbot\auction\manager.py:11 in <module>                                                             │
│                                                                                                                      │
│     8 from dataclasses import dataclass                                                                              │
│     9 from typing import Any                                                                                         │
│    10                                                                                                                │
│ ❱  11 import pandas as pd                                                                                            │
│    12 from pydantic import SecretStr                                                                                 │
│    13 from rich.progress import Progress, TaskID, TimeElapsedColumn                                                  │
│    14                                                                                                                │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │ annotations = _Feature((3, 7, 0, 'beta', 1), None, 16777216)                                                     │ │
│ │         Any = typing.Any                                                                                         │ │
│ │  contextlib = <module 'contextlib' from                                                                          │ │
│ │               'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\contextlib.py'>                │ │
│ │     Counter = <class 'collections.Counter'>                                                                      │ │
│ │   dataclass = <function dataclass at 0x00000192D5D6AF20>                                                         │ │
│ │    datetime = <module 'datetime' from                                                                            │ │
│ │               'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\datetime.py'>                  │ │
│ │   Generator = <class 'collections.abc.Generator'>                                                                │ │
│ │      random = <module 'random' from                                                                              │ │
│ │               'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\random.py'>                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ C:\ffxiahbot\.venv\Lib\site-packages\pandas\__init__.py:62 in <module>                                               │
│                                                                                                                      │
│    59 # let init-time option registration happen                                                                     │
│    60 import pandas.core.config_init  # pyright: ignore[reportUnusedImport] # noqa: F401                             │
│    61                                                                                                                │
│ ❱  62 from pandas.core.api import (                                                                                  │
│    63 │   # dtype                                                                                                    │
│    64 │   ArrowDtype,                                                                                                │
│    65 │   Int8Dtype,                                                                                                 │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │               _config = <module 'pandas._config' from                                                            │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\_config\\__init__.py'>                │ │
│ │         _is_numpy_dev = False                                                                                    │ │
│ │                 _libs = <module 'pandas._libs' from                                                              │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\_libs\\__init__.py'>                  │ │
│ │ _pandas_datetime_CAPI = <capsule object "pandas._pandas_datetime_CAPI" at 0x00000192FF35DFE0>                    │ │
│ │   _pandas_parser_CAPI = <capsule object "pandas._pandas_parser_CAPI" at 0x00000192FF35DCE0>                      │ │
│ │               _typing = <module 'pandas._typing' from                                                            │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\_typing.py'>                          │ │
│ │           annotations = _Feature((3, 7, 0, 'beta', 1), None, 16777216)                                           │ │
│ │                arrays = <module 'pandas.arrays' from                                                             │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\arrays\\__init__.py'>                 │ │
│ │                compat = <module 'pandas.compat' from                                                             │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\compat\\__init__.py'>                 │ │
│ │                  core = <module 'pandas.core' from                                                               │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\core\\__init__.py'>                   │ │
│ │       describe_option = <pandas._config.config.CallableDynamicDoc object at 0x00000192FF3431A0>                  │ │
│ │                errors = <module 'pandas.errors' from                                                             │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\errors\\__init__.py'>                 │ │
│ │            get_option = <pandas._config.config.CallableDynamicDoc object at 0x00000192FF30AB10>                  │ │
│ │                    io = <module 'pandas.io' from                                                                 │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\io\\__init__.py'>                     │ │
│ │        option_context = <class 'pandas._config.config.option_context'>                                           │ │
│ │               options = <pandas._config.config.DictWrapper object at 0x00000192FF3430B0>                         │ │
│ │                    os = <module 'os' (frozen)>                                                                   │ │
│ │                pandas = <module 'pandas' from 'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\__init__.py'>   │ │
│ │              plotting = <module 'pandas.plotting' from                                                           │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\plotting\\__init__.py'>               │ │
│ │          reset_option = <pandas._config.config.CallableDynamicDoc object at 0x00000192FF3430E0>                  │ │
│ │            set_option = <pandas._config.config.CallableDynamicDoc object at 0x00000192FF343080>                  │ │
│ │               tseries = <module 'pandas.tseries' from                                                            │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\tseries\\__init__.py'>                │ │
│ │                  util = <module 'pandas.util' from                                                               │ │
│ │                         'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\util\\__init__.py'>                   │ │
│ │              warnings = <module 'warnings' from                                                                  │ │
│ │                         'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\warnings.py'>        │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ C:\ffxiahbot\.venv\Lib\site-packages\pandas\core\api.py:47 in <module>                                               │
│                                                                                                                      │
│    44 from pandas.core.arrays.string_ import StringDtype                                                             │
│    45 from pandas.core.construction import array                                                                     │
│    46 from pandas.core.flags import Flags                                                                            │
│ ❱  47 from pandas.core.groupby import (                                                                              │
│    48 │   Grouper,                                                                                                   │
│    49 │   NamedAgg,                                                                                                  │
│    50 )                                                                                                              │
│                                                                                                                      │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮                                          │
│ │            array = <function array at 0x00000192FF5C6520>               │                                          │
│ │       ArrowDtype = <class 'pandas.core.dtypes.dtypes.ArrowDtype'>       │                                          │
│ │     BooleanDtype = <class 'pandas.core.arrays.boolean.BooleanDtype'>    │                                          │
│ │      Categorical = <class 'pandas.core.arrays.categorical.Categorical'> │                                          │
│ │ CategoricalDtype = <class 'pandas.core.dtypes.dtypes.CategoricalDtype'> │                                          │
│ │  DatetimeTZDtype = <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>  │                                          │
│ │        factorize = <function factorize at 0x00000192FF6416C0>           │                                          │
│ │            Flags = <class 'pandas.core.flags.Flags'>                    │                                          │
│ │     Float32Dtype = <class 'pandas.core.arrays.floating.Float32Dtype'>   │                                          │
│ │     Float64Dtype = <class 'pandas.core.arrays.floating.Float64Dtype'>   │                                          │
│ │       Int16Dtype = <class 'pandas.core.arrays.integer.Int16Dtype'>      │                                          │
│ │       Int32Dtype = <class 'pandas.core.arrays.integer.Int32Dtype'>      │                                          │
│ │       Int64Dtype = <class 'pandas.core.arrays.integer.Int64Dtype'>      │                                          │
│ │        Int8Dtype = <class 'pandas.core.arrays.integer.Int8Dtype'>       │                                          │
│ │    IntervalDtype = <class 'pandas.core.dtypes.dtypes.IntervalDtype'>    │                                          │
│ │             isna = <function isna at 0x00000192FF5A1260>                │                                          │
│ │           isnull = <function isna at 0x00000192FF5A1260>                │                                          │
│ │               NA = <NA>                                                 │                                          │
│ │              NaT = NaT                                                  │                                          │
│ │            notna = <function notna at 0x00000192FF5A1A80>               │                                          │
│ │          notnull = <function notna at 0x00000192FF5A1A80>               │                                          │
│ │           Period = <class 'pandas._libs.tslibs.period.Period'>          │                                          │
│ │      PeriodDtype = <class 'pandas.core.dtypes.dtypes.PeriodDtype'>      │                                          │
│ │      StringDtype = <class 'pandas.core.arrays.string_.StringDtype'>     │                                          │
│ │        Timedelta = <class 'pandas._libs.tslibs.timedeltas.Timedelta'>   │                                          │
│ │        Timestamp = <class 'pandas._libs.tslibs.timestamps.Timestamp'>   │                                          │
│ │      UInt16Dtype = <class 'pandas.core.arrays.integer.UInt16Dtype'>     │                                          │
│ │      UInt32Dtype = <class 'pandas.core.arrays.integer.UInt32Dtype'>     │                                          │
│ │      UInt64Dtype = <class 'pandas.core.arrays.integer.UInt64Dtype'>     │                                          │
│ │       UInt8Dtype = <class 'pandas.core.arrays.integer.UInt8Dtype'>      │                                          │
│ │           unique = <function unique at 0x00000192FF6413A0>              │                                          │
│ │     value_counts = <function value_counts at 0x00000192FF641760>        │                                          │
│ ╰─────────────────────────────────────────────────────────────────────────╯                                          │
│                                                                                                                      │
│ C:\ffxiahbot\.venv\Lib\site-packages\pandas\core\groupby\__init__.py:1 in <module>                                   │
│                                                                                                                      │
│ ❱  1 from pandas.core.groupby.generic import (                                                                       │
│    2 │   DataFrameGroupBy,                                                                                           │
│    3 │   NamedAgg,                                                                                                   │
│    4 │   SeriesGroupBy,                                                                                              │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │ base = <module 'pandas.core.groupby.base' from                                                                   │ │
│ │        'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\core\\groupby\\base.py'>                               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ C:\ffxiahbot\.venv\Lib\site-packages\pandas\core\groupby\generic.py:69 in <module>                                   │
│                                                                                                                      │
│     66 )                                                                                                             │
│     67 import pandas.core.common as com                                                                              │
│     68 from pandas.core.frame import DataFrame                                                                       │
│ ❱   69 from pandas.core.groupby import (                                                                             │
│     70 │   base,                                                                                                     │
│     71 │   ops,                                                                                                      │
│     72 )                                                                                                             │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │                    abc = <module 'collections.abc' from                                                          │ │
│ │                          'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\collections\\abc.p… │ │
│ │             algorithms = <module 'pandas.core.algorithms' from                                                   │ │
│ │                          'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\core\\algorithms.py'>                │ │
│ │            annotations = _Feature((3, 7, 0, 'beta', 1), None, 16777216)                                          │ │
│ │                    Any = typing.Any                                                                              │ │
│ │               Appender = <class 'pandas.util._decorators.Appender'>                                              │ │
│ │               Callable = typing.Callable                                                                         │ │
│ │                   cast = <function cast at 0x00000192D42EAFC0>                                                   │ │
│ │       CategoricalDtype = <class 'pandas.core.dtypes.dtypes.CategoricalDtype'>                                    │ │
│ │                    com = <module 'pandas.core.common' from                                                       │ │
│ │                          'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\core\\common.py'>                    │ │
│ │              DataFrame = <class 'pandas.core.frame.DataFrame'>                                                   │ │
│ │                 dedent = <function dedent at 0x00000192D3FAEF20>                                                 │ │
│ │                    doc = <function doc at 0x00000192FF5A2E80>                                                    │ │
│ │             duplicated = <cyfunction duplicated at 0x00000192FF4C9FC0>                                           │ │
│ │           ensure_int64 = <cyfunction ensure_int64 at 0x00000192FF4FF6B0>                                         │ │
│ │       find_stack_level = <function find_stack_level at 0x00000192FF31D760>                                       │ │
│ │           GroupByApply = <class 'pandas.core.apply.GroupByApply'>                                                │ │
│ │               Interval = <class 'pandas._libs.interval.Interval'>                                                │ │
│ │          IntervalDtype = <class 'pandas.core.dtypes.dtypes.IntervalDtype'>                                       │ │
│ │                is_bool = <cyfunction is_bool at 0x00000192FF558D40>                                              │ │
│ │           is_dict_like = <function is_dict_like at 0x00000192FF576200>                                           │ │
│ │            is_hashable = <function is_hashable at 0x00000192FF576340>                                            │ │
│ │       is_integer_dtype = <function is_integer_dtype at 0x00000192FF5A0040>                                       │ │
│ │           is_list_like = <cyfunction is_list_like at 0x00000192FF559150>                                         │ │
│ │       is_numeric_dtype = <function is_numeric_dtype at 0x00000192FF5A05E0>                                       │ │
│ │              is_scalar = <cyfunction is_scalar at 0x00000192FF52FB90>                                            │ │
│ │                   isna = <function isna at 0x00000192FF5A1260>                                                   │ │
│ │                    lib = <module 'pandas._libs.lib' from                                                         │ │
│ │                          'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\pandas\\_libs\\lib.cp312-win_amd64.pyd'>     │ │
│ │                Literal = typing.Literal                                                                          │ │
│ │   maybe_mangle_lambdas = <function maybe_mangle_lambdas at 0x00000192FF8E4720>                                   │ │
│ │             NamedTuple = <function NamedTuple at 0x00000192D42EB920>                                             │ │
│ │                  notna = <function notna at 0x00000192FF5A1A80>                                                  │ │
│ │                     np = <module 'numpy' from 'C:\\ffxiahbot\\.venv\\Lib\\site-packages\\numpy\\__init__.py'>    │ │
│ │                partial = <class 'functools.partial'>                                                             │ │
│ │       reconstruct_func = <function reconstruct_func at 0x00000192FF8BCEA0>                                       │ │
│ │     SpecificationError = <class 'pandas.errors.SpecificationError'>                                              │ │
│ │           Substitution = <class 'pandas.util._decorators.Substitution'>                                          │ │
│ │          TYPE_CHECKING = False                                                                                   │ │
│ │                TypeVar = <class 'typing.TypeVar'>                                                                │ │
│ │                  Union = typing.Union                                                                            │ │
│ │   validate_func_kwargs = <function validate_func_kwargs at 0x00000192FF8E47C0>                                   │ │
│ │ warn_alias_replacement = <function warn_alias_replacement at 0x00000192FF8E4900>                                 │ │
│ │               warnings = <module 'warnings' from                                                                 │ │
│ │                          'C:\\Users\\Reed\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\warnings.py'>       │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                      │
│ ▲                                                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
SyntaxError: source code string cannot contain null bytes
@reedwhaley
Copy link
Author

reedwhaley commented Oct 24, 2024

Here is my config.yaml file with user and pass redacted. 3316 is the correct port for the SQL server.

# ah
name: Mewbot
tick: 30
restock: 3600
use_buying_rates: false
use_selling_rates: false

# sql
hostname: 127.0.0.1
database: xidb
username: 
password: 
port: 3316
fail: false

@AdamGagorik
Copy link
Owner

I am not sure what is going on with this one. I am wondering how you downloaded the source code - were you just using git? A quick google search is suggesting that something is off with the encoding of the source files.

@AdamGagorik
Copy link
Owner

If this is a result of uv not working on windows (I really hope not), you can try one of the alternate ways to install the python dependencies and run the script.

@AdamGagorik
Copy link
Owner

Can you also try the following?

uv run python
import pandas
print(pandas.__version__)

@reedwhaley
Copy link
Author

Sure thing, I’m out with my kids for Halloween so it’ll be later this evening before I can.

@AdamGagorik
Copy link
Owner

I don't have access to windows but asked a friend to try things out - it was working for him. I'm thinking there's something about the permissions or file encodings of the source files you downloaded. If you didn't use git to download the codebase I would try that method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants